diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2010-04-13 12:56:11 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2010-09-01 17:08:13 (GMT) |
commit | cd626ea66ed114736ddf5d6a4c989ef6c9b8d248 (patch) | |
tree | d8ccb910ff35239ec4b178eea39df7e439a979a1 /Source | |
parent | c4f7034efb1ded09f3a2ca2915c9a6f1766ddf4b (diff) | |
download | CMake-cd626ea66ed114736ddf5d6a4c989ef6c9b8d248.zip CMake-cd626ea66ed114736ddf5d6a4c989ef6c9b8d248.tar.gz CMake-cd626ea66ed114736ddf5d6a4c989ef6c9b8d248.tar.bz2 |
For macros make sure the FilePath points to a valid pointer in the args.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmMacroCommand.cxx | 12 | ||||
-rw-r--r-- | Source/cmMacroCommand.h | 1 |
2 files changed, 10 insertions, 3 deletions
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 497949a..774f32b 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -31,6 +31,7 @@ public: // we must copy when we clone newC->Args = this->Args; newC->Functions = this->Functions; + newC->FilePath = this->FilePath; newC->Policies = this->Policies; return newC; } @@ -78,6 +79,7 @@ public: std::vector<std::string> Args; std::vector<cmListFileFunction> Functions; cmPolicies::PolicyMap Policies; + std::string FilePath; }; @@ -121,7 +123,10 @@ bool cmMacroHelperCommand::InvokeInitialPass std::string argnDef; bool argnDefInitialized = false; bool argvDefInitialized = false; - + if( this->Functions.size()) + { + this->FilePath = this->Functions[0].FilePath; + } // Invoke all the functions that were collected in the block. cmListFileFunction newLFF; // for each function @@ -135,10 +140,13 @@ bool cmMacroHelperCommand::InvokeInitialPass newLFF.Line = this->Functions[c].Line; // for each argument of the current function - for (std::vector<cmListFileArgument>::const_iterator k = + for (std::vector<cmListFileArgument>::iterator k = this->Functions[c].Arguments.begin(); k != this->Functions[c].Arguments.end(); ++k) { + // Set the FilePath on the arguments to match the function since it is + // not stored and the original values may be freed + k->FilePath = this->FilePath.c_str(); tmps = k->Value; // replace formal arguments for (unsigned int j = 1; j < this->Args.size(); ++j) diff --git a/Source/cmMacroCommand.h b/Source/cmMacroCommand.h index 3457da2..93e10b2 100644 --- a/Source/cmMacroCommand.h +++ b/Source/cmMacroCommand.h @@ -112,7 +112,6 @@ public: "policies inside macros." ; } - cmTypeMacro(cmMacroCommand, cmCommand); }; |