[Cmake-commits] [cmake-commits] king committed cmLocalGenerator.cxx 1.305 1.306
cmake-commits at cmake.org
cmake-commits at cmake.org
Thu Sep 3 08:26:34 EDT 2009
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv8150/Source
Modified Files:
cmLocalGenerator.cxx
Log Message:
Manage current local generator with automatic var
The cmLocalGenerator::Configure method sets its cmLocalGenerator
instance as the global generator's current local generator during
configuration. This commit refactors management of the current local
generator to use an automatic variable. This will allow early returns
from the method.
Index: cmLocalGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalGenerator.cxx,v
retrieving revision 1.305
retrieving revision 1.306
diff -C 2 -d -r1.305 -r1.306
*** cmLocalGenerator.cxx 4 Aug 2009 19:41:57 -0000 1.305
--- cmLocalGenerator.cxx 3 Sep 2009 12:26:31 -0000 1.306
***************
*** 69,77 ****
}
void cmLocalGenerator::Configure()
{
! cmLocalGenerator* previousLg =
! this->GetGlobalGenerator()->GetCurrentLocalGenerator();
! this->GetGlobalGenerator()->SetCurrentLocalGenerator(this);
// make sure the CMakeFiles dir is there
--- 69,96 ----
}
+ //----------------------------------------------------------------------------
+ class cmLocalGeneratorCurrent
+ {
+ cmGlobalGenerator* GG;
+ cmLocalGenerator* LG;
+ public:
+ cmLocalGeneratorCurrent(cmLocalGenerator* lg)
+ {
+ this->GG = lg->GetGlobalGenerator();
+ this->LG = this->GG->GetCurrentLocalGenerator();
+ this->GG->SetCurrentLocalGenerator(lg);
+ }
+ ~cmLocalGeneratorCurrent()
+ {
+ this->GG->SetCurrentLocalGenerator(this->LG);
+ }
+ };
+
+ //----------------------------------------------------------------------------
void cmLocalGenerator::Configure()
{
! // Manage the global generator's current local generator.
! cmLocalGeneratorCurrent clg(this);
! static_cast<void>(clg);
// make sure the CMakeFiles dir is there
***************
*** 142,147 ****
this->Configured = true;
-
- this->GetGlobalGenerator()->SetCurrentLocalGenerator(previousLg);
}
--- 161,164 ----
More information about the Cmake-commits
mailing list