From d6239507b2f08bd1fee53c84af3998a14fa9819b Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 8 Jul 2015 23:11:22 +0200 Subject: cmMakefile: Split accessors for compile definitions and origins. --- Source/cmGlobalGenerator.cxx | 12 ++++++++---- Source/cmMakefile.cxx | 20 ++++++++------------ Source/cmMakefile.h | 3 ++- Source/cmTarget.cxx | 7 ++++--- Source/cmTarget.h | 3 ++- 5 files changed, 24 insertions(+), 21 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 88ac0bc..2c5ed4f 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1417,8 +1417,10 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo() { cmMakefile *mf = this->LocalGenerators[i]->GetMakefile(); - const std::vector noconfig_compile_definitions = + const std::vector noconfig_compile_definitions = mf->GetCompileDefinitionsEntries(); + const std::vector noconfig_compile_definitions_bts = + mf->GetCompileDefinitionsBacktraces(); cmTargets& targets = mf->GetTargets(); for(cmTargets::iterator ti = targets.begin(); @@ -1433,11 +1435,13 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo() continue; } - for (std::vector::const_iterator it + std::vector::const_iterator btIt + = noconfig_compile_definitions_bts.begin(); + for (std::vector::const_iterator it = noconfig_compile_definitions.begin(); - it != noconfig_compile_definitions.end(); ++it) + it != noconfig_compile_definitions.end(); ++it, ++btIt) { - t->InsertCompileDefinition(*it); + t->InsertCompileDefinition(*it, *btIt); } cmPolicies::PolicyStatus polSt diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index dc8d983..c705e7d 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -303,19 +303,15 @@ std::vector cmMakefile::GetCompileOptionsEntries() const return entries; } -std::vector cmMakefile::GetCompileDefinitionsEntries() const +std::vector cmMakefile::GetCompileDefinitionsEntries() const { - std::vector entries; - entries.reserve(this->CompileDefinitionsEntries.size()); - std::vector::const_iterator btIt = - this->CompileDefinitionsEntryBacktraces.begin(); - for(std::vector::const_iterator it = - this->CompileDefinitionsEntries.begin(); - it != this->CompileDefinitionsEntries.end(); ++it, ++btIt) - { - entries.push_back(cmValueWithOrigin(*it, *btIt)); - } - return entries; + return this->CompileDefinitionsEntries; +} + +std::vector +cmMakefile::GetCompileDefinitionsBacktraces() const +{ + return this->CompileDefinitionsEntryBacktraces; } //---------------------------------------------------------------------------- diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 57dcdb6..e69ce1e 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -748,7 +748,8 @@ public: std::vector GetIncludeDirectoriesEntries() const; std::vector GetCompileOptionsEntries() const; - std::vector GetCompileDefinitionsEntries() const; + std::vector GetCompileDefinitionsEntries() const; + std::vector GetCompileDefinitionsBacktraces() const; bool IsConfigured() const { return this->Configured; } void SetConfigured(){ this->Configured = true; } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index ac39387..906517b 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1954,12 +1954,13 @@ void cmTarget::InsertCompileOption(const cmValueWithOrigin &entry, } //---------------------------------------------------------------------------- -void cmTarget::InsertCompileDefinition(const cmValueWithOrigin &entry) +void cmTarget::InsertCompileDefinition(std::string const& entry, + cmListFileBacktrace const& bt) { - cmGeneratorExpression ge(entry.Backtrace); + cmGeneratorExpression ge(bt); this->Internal->CompileDefinitionsEntries.push_back( - new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry.Value))); + new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry))); } //---------------------------------------------------------------------------- diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 1920312..9c98672 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -576,7 +576,8 @@ public: bool before = false); void InsertCompileOption(const cmValueWithOrigin &entry, bool before = false); - void InsertCompileDefinition(const cmValueWithOrigin &entry); + void InsertCompileDefinition(std::string const& entry, + cmListFileBacktrace const& bt); void AppendBuildInterfaceIncludes(); -- cgit v0.12