diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-07-08 21:52:51 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-07-17 20:14:37 (GMT) |
commit | fc1c7cf85d045323a38c1de7ada213ecfee542a9 (patch) | |
tree | c5af2358b6ff05121e4cfed187ba58bf1a074681 /Source | |
parent | 4dc4570734e70c47c8bb6d658c1014f29068e106 (diff) | |
download | CMake-fc1c7cf85d045323a38c1de7ada213ecfee542a9.zip CMake-fc1c7cf85d045323a38c1de7ada213ecfee542a9.tar.gz CMake-fc1c7cf85d045323a38c1de7ada213ecfee542a9.tar.bz2 |
Genex: Store a backtrace, not a pointer to one.
The storage of a pointer means that the ownership and lifetime are
externally determined, which is harder to reason about. It also imposes
API constraints, requiring APIs to return references to backtraces.
This pointer storage was introduced in commit v3.1.0-rc1~425^2~3 (genex:
remove the need for backtraces, 2014-05-23). As backtraces are now cheap
to copy around, just do that instead.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmCustomCommandGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmFileCommand.cxx | 4 | ||||
-rw-r--r-- | Source/cmGeneratorExpression.cxx | 6 | ||||
-rw-r--r-- | Source/cmGeneratorExpression.h | 5 | ||||
-rw-r--r-- | Source/cmGeneratorExpressionEvaluationFile.cxx | 2 | ||||
-rw-r--r-- | Source/cmGeneratorExpressionNode.cxx | 2 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 2 | ||||
-rw-r--r-- | Source/cmInstalledFile.cxx | 4 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 36 | ||||
-rw-r--r-- | Source/cmTestGenerator.cxx | 2 |
10 files changed, 32 insertions, 33 deletions
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index 11308c6..f654eb9 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -21,7 +21,7 @@ cmCustomCommandGenerator::cmCustomCommandGenerator( cmCustomCommand const& cc, const std::string& config, cmMakefile* mf): CC(cc), Config(config), Makefile(mf), OldStyle(cc.GetEscapeOldStyle()), MakeVars(cc.GetEscapeAllowMakeVars()), - GE(new cmGeneratorExpression(&cc.GetBacktrace())), DependsDone(false) + GE(new cmGeneratorExpression(cc.GetBacktrace())), DependsDone(false) { } diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index f740020..3d84f38 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -3565,11 +3565,11 @@ void cmFileCommand::AddEvaluationFile(const std::string &inputName, { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression outputGe(&lfbt); + cmGeneratorExpression outputGe(lfbt); cmsys::auto_ptr<cmCompiledGeneratorExpression> outputCge = outputGe.Parse(outputExpr); - cmGeneratorExpression conditionGe(&lfbt); + cmGeneratorExpression conditionGe(lfbt); cmsys::auto_ptr<cmCompiledGeneratorExpression> conditionCge = conditionGe.Parse(condition); diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 3655a87..80a4f81 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -23,7 +23,7 @@ //---------------------------------------------------------------------------- cmGeneratorExpression::cmGeneratorExpression( - cmListFileBacktrace const* backtrace): + const cmListFileBacktrace& backtrace): Backtrace(backtrace) { } @@ -33,9 +33,7 @@ cmsys::auto_ptr<cmCompiledGeneratorExpression> cmGeneratorExpression::Parse(std::string const& input) { return cmsys::auto_ptr<cmCompiledGeneratorExpression>( - new cmCompiledGeneratorExpression( - this->Backtrace ? *this->Backtrace : cmListFileBacktrace(), - input)); + new cmCompiledGeneratorExpression(this->Backtrace, input)); } //---------------------------------------------------------------------------- diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 11c27fd..cd19bc0 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -42,7 +42,8 @@ class cmGeneratorExpression { public: /** Construct. */ - cmGeneratorExpression(cmListFileBacktrace const* backtrace = NULL); + cmGeneratorExpression( + cmListFileBacktrace const& backtrace = cmListFileBacktrace()); ~cmGeneratorExpression(); cmsys::auto_ptr<cmCompiledGeneratorExpression> Parse( @@ -71,7 +72,7 @@ private: cmGeneratorExpression(const cmGeneratorExpression &); void operator=(const cmGeneratorExpression &); - cmListFileBacktrace const* Backtrace; + cmListFileBacktrace Backtrace; }; class cmCompiledGeneratorExpression diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx index c726995..92ff314 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.cxx +++ b/Source/cmGeneratorExpressionEvaluationFile.cxx @@ -152,7 +152,7 @@ void cmGeneratorExpressionEvaluationFile::Generate() } cmListFileBacktrace lfbt = this->OutputFileExpr->GetBacktrace(); - cmGeneratorExpression contentGE(&lfbt); + cmGeneratorExpression contentGE(lfbt); cmsys::auto_ptr<cmCompiledGeneratorExpression> inputExpression = contentGE.Parse(inputContent); diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 293eb41..90c82c2 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -21,7 +21,7 @@ std::string cmGeneratorExpressionNode::EvaluateDependentExpression( cmTarget const* headTarget, cmTarget const* currentTarget, cmGeneratorExpressionDAGChecker *dagChecker) { - cmGeneratorExpression ge(&context->Backtrace); + cmGeneratorExpression ge(context->Backtrace); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop); cge->SetEvaluateForBuildsystem(context->EvaluateForBuildsystem); std::string result = cge->Evaluate(makefile, diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 4494553..e6f7a43 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -878,7 +878,7 @@ cmTargetTraceDependencies { // Transform command names that reference targets built in this // project to corresponding target-level dependencies. - cmGeneratorExpression ge(&cc.GetBacktrace()); + cmGeneratorExpression ge(cc.GetBacktrace()); // Add target-level dependencies referenced by generator expressions. std::set<cmTarget*> targets; diff --git a/Source/cmInstalledFile.cxx b/Source/cmInstalledFile.cxx index 8c52b48..fa5e815 100644 --- a/Source/cmInstalledFile.cxx +++ b/Source/cmInstalledFile.cxx @@ -44,7 +44,7 @@ cmInstalledFile::Property::~Property() void cmInstalledFile::SetName(cmMakefile* mf, const std::string& name) { cmListFileBacktrace backtrace = mf->GetBacktrace(); - cmGeneratorExpression ge(&backtrace); + cmGeneratorExpression ge(backtrace); this->Name = name; this->NameExpression = ge.Parse(name).release(); @@ -81,7 +81,7 @@ void cmInstalledFile::AppendProperty(cmMakefile const* mf, const std::string& prop, const char* value, bool /*asString*/) { cmListFileBacktrace backtrace = mf->GetBacktrace(); - cmGeneratorExpression ge(&backtrace); + cmGeneratorExpression ge(backtrace); Property& property = this->Properties[prop]; property.ValueExpressions.push_back(ge.Parse(value).release()); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 0303f1e..46e9ed4 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -916,7 +916,7 @@ void cmTarget::AddTracedSources(std::vector<std::string> const& srcs) this->Internal->SourceFilesMap.clear(); this->LinkImplementationLanguageIsContextDependent = true; cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(&lfbt); + cmGeneratorExpression ge(lfbt); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(srcFiles); cge->SetEvaluateForBuildsystem(true); this->Internal->SourceEntries.push_back( @@ -956,7 +956,7 @@ void cmTarget::AddSources(std::vector<std::string> const& srcs) this->Internal->SourceFilesMap.clear(); this->LinkImplementationLanguageIsContextDependent = true; cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(&lfbt); + cmGeneratorExpression ge(lfbt); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(srcFiles); cge->SetEvaluateForBuildsystem(true); this->Internal->SourceEntries.push_back( @@ -1089,7 +1089,7 @@ cmSourceFile* cmTarget::AddSource(const std::string& src) this->Internal->SourceFilesMap.clear(); this->LinkImplementationLanguageIsContextDependent = true; cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(&lfbt); + cmGeneratorExpression ge(lfbt); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(src); cge->SetEvaluateForBuildsystem(true); this->Internal->SourceEntries.push_back( @@ -1710,7 +1710,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) else if(prop == "INCLUDE_DIRECTORIES") { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(&lfbt); + cmGeneratorExpression ge(lfbt); deleteAndClear(this->Internal->IncludeDirectoriesEntries); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value); this->Internal->IncludeDirectoriesEntries.push_back( @@ -1719,7 +1719,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) else if(prop == "COMPILE_OPTIONS") { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(&lfbt); + cmGeneratorExpression ge(lfbt); deleteAndClear(this->Internal->CompileOptionsEntries); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value); this->Internal->CompileOptionsEntries.push_back( @@ -1728,7 +1728,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) else if(prop == "COMPILE_FEATURES") { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(&lfbt); + cmGeneratorExpression ge(lfbt); deleteAndClear(this->Internal->CompileFeaturesEntries); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value); this->Internal->CompileFeaturesEntries.push_back( @@ -1737,7 +1737,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) else if(prop == "COMPILE_DEFINITIONS") { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(&lfbt); + cmGeneratorExpression ge(lfbt); deleteAndClear(this->Internal->CompileDefinitionsEntries); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value); this->Internal->CompileDefinitionsEntries.push_back( @@ -1772,7 +1772,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) } this->Internal->SourceFilesMap.clear(); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(&lfbt); + cmGeneratorExpression ge(lfbt); this->Internal->SourceEntries.clear(); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value); this->Internal->SourceEntries.push_back( @@ -1808,28 +1808,28 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value, else if(prop == "INCLUDE_DIRECTORIES") { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(&lfbt); + cmGeneratorExpression ge(lfbt); this->Internal->IncludeDirectoriesEntries.push_back( new cmTargetInternals::TargetPropertyEntry(ge.Parse(value))); } else if(prop == "COMPILE_OPTIONS") { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(&lfbt); + cmGeneratorExpression ge(lfbt); this->Internal->CompileOptionsEntries.push_back( new cmTargetInternals::TargetPropertyEntry(ge.Parse(value))); } else if(prop == "COMPILE_FEATURES") { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(&lfbt); + cmGeneratorExpression ge(lfbt); this->Internal->CompileFeaturesEntries.push_back( new cmTargetInternals::TargetPropertyEntry(ge.Parse(value))); } else if(prop == "COMPILE_DEFINITIONS") { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(&lfbt); + cmGeneratorExpression ge(lfbt); this->Internal->CompileDefinitionsEntries.push_back( new cmTargetInternals::TargetPropertyEntry(ge.Parse(value))); } @@ -1861,7 +1861,7 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value, } this->Internal->SourceFilesMap.clear(); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(&lfbt); + cmGeneratorExpression ge(lfbt); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value); this->Internal->SourceEntries.push_back( new cmTargetInternals::TargetPropertyEntry(cge)); @@ -1929,7 +1929,7 @@ void cmTarget::AppendBuildInterfaceIncludes() void cmTarget::InsertInclude(const cmValueWithOrigin &entry, bool before) { - cmGeneratorExpression ge(&entry.Backtrace); + cmGeneratorExpression ge(entry.Backtrace); std::vector<cmTargetInternals::TargetPropertyEntry*>::iterator position = before ? this->Internal->IncludeDirectoriesEntries.begin() @@ -1943,7 +1943,7 @@ void cmTarget::InsertInclude(const cmValueWithOrigin &entry, void cmTarget::InsertCompileOption(const cmValueWithOrigin &entry, bool before) { - cmGeneratorExpression ge(&entry.Backtrace); + cmGeneratorExpression ge(entry.Backtrace); std::vector<cmTargetInternals::TargetPropertyEntry*>::iterator position = before ? this->Internal->CompileOptionsEntries.begin() @@ -1956,7 +1956,7 @@ void cmTarget::InsertCompileOption(const cmValueWithOrigin &entry, //---------------------------------------------------------------------------- void cmTarget::InsertCompileDefinition(const cmValueWithOrigin &entry) { - cmGeneratorExpression ge(&entry.Backtrace); + cmGeneratorExpression ge(entry.Backtrace); this->Internal->CompileDefinitionsEntries.push_back( new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry.Value))); @@ -6162,7 +6162,7 @@ void cmTargetInternals::AddInterfaceEntries( { std::string genex = "$<TARGET_PROPERTY:" + *it + "," + prop + ">"; - cmGeneratorExpression ge(&it->Backtrace); + cmGeneratorExpression ge(it->Backtrace); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(genex); cge->SetEvaluateForBuildsystem(true); entries.push_back( @@ -6258,7 +6258,7 @@ cmTargetInternals::ComputeLinkImplementationLibraries( cmGeneratorExpressionDAGChecker dagChecker( thisTarget->GetName(), "LINK_LIBRARIES", 0, 0); - cmGeneratorExpression ge(&le->Backtrace); + cmGeneratorExpression ge(le->Backtrace); cmsys::auto_ptr<cmCompiledGeneratorExpression> const cge = ge.Parse(le->Value); std::string const evaluated = diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx index 546ad71..65d3b6a 100644 --- a/Source/cmTestGenerator.cxx +++ b/Source/cmTestGenerator.cxx @@ -70,7 +70,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, this->TestGenerated = true; // Set up generator expression evaluation context. - cmGeneratorExpression ge(&this->Test->GetBacktrace()); + cmGeneratorExpression ge(this->Test->GetBacktrace()); // Start the test command. os << indent << "add_test(" << this->Test->GetName() << " "; |