cmMakefile: Use Ranges for buildsystem property access.

Don't return vector copies.
This commit is contained in:
Stephen Kelly 2015-07-18 10:52:09 +02:00
parent 514a1dff5b
commit 8d336875b3
4 changed files with 30 additions and 34 deletions

View File

@ -1417,9 +1417,9 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo()
{
cmMakefile *mf = this->LocalGenerators[i]->GetMakefile();
const std::vector<std::string> noconfig_compile_definitions =
const cmStringRange noconfig_compile_definitions =
mf->GetCompileDefinitionsEntries();
const std::vector<cmListFileBacktrace> noconfig_compile_definitions_bts =
const cmBacktraceRange noconfig_compile_definitions_bts =
mf->GetCompileDefinitionsBacktraces();
cmTargets& targets = mf->GetTargets();
@ -1435,9 +1435,9 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo()
continue;
}
std::vector<cmListFileBacktrace>::const_iterator btIt
cmBacktraceRange::const_iterator btIt
= noconfig_compile_definitions_bts.begin();
for (std::vector<std::string>::const_iterator it
for (cmStringRange::const_iterator it
= noconfig_compile_definitions.begin();
it != noconfig_compile_definitions.end(); ++it, ++btIt)
{

View File

@ -273,38 +273,34 @@ void cmMakefile::IssueMessage(cmake::MessageType t,
}
}
std::vector<std::string> cmMakefile::GetIncludeDirectoriesEntries() const
cmStringRange cmMakefile::GetIncludeDirectoriesEntries() const
{
return this->IncludeDirectoriesEntries;
return cmMakeRange(this->IncludeDirectoriesEntries);
}
std::vector<cmListFileBacktrace>
cmMakefile::GetIncludeDirectoriesBacktraces() const
cmBacktraceRange cmMakefile::GetIncludeDirectoriesBacktraces() const
{
return this->IncludeDirectoriesEntryBacktraces;
return cmMakeRange(this->IncludeDirectoriesEntryBacktraces);
}
std::vector<std::string> cmMakefile::GetCompileOptionsEntries() const
cmStringRange cmMakefile::GetCompileOptionsEntries() const
{
return this->CompileOptionsEntries;
return cmMakeRange(this->CompileOptionsEntries);
}
std::vector<cmListFileBacktrace>
cmMakefile::GetCompileOptionsBacktraces() const
cmBacktraceRange cmMakefile::GetCompileOptionsBacktraces() const
{
return this->CompileOptionsEntryBacktraces;
return cmMakeRange(this->CompileOptionsEntryBacktraces);
}
std::vector<std::string> cmMakefile::GetCompileDefinitionsEntries() const
cmStringRange cmMakefile::GetCompileDefinitionsEntries() const
{
return this->CompileDefinitionsEntries;
return cmMakeRange(this->CompileDefinitionsEntries);
}
std::vector<cmListFileBacktrace>
cmMakefile::GetCompileDefinitionsBacktraces() const
cmBacktraceRange cmMakefile::GetCompileDefinitionsBacktraces() const
{
return this->CompileDefinitionsEntryBacktraces;
return cmMakeRange(this->CompileDefinitionsEntryBacktraces);
}
//----------------------------------------------------------------------------

View File

@ -22,6 +22,7 @@
#include "cmExpandedCommandArgument.h"
#include "cmake.h"
#include "cmState.h"
#include "cmAlgorithms.h"
#if defined(CMAKE_BUILD_WITH_CMAKE)
#include "cmSourceGroup.h"
@ -746,12 +747,12 @@ public:
/** Set whether or not to report a CMP0000 violation. */
void SetCheckCMP0000(bool b) { this->CheckCMP0000 = b; }
std::vector<std::string> GetIncludeDirectoriesEntries() const;
std::vector<cmListFileBacktrace> GetIncludeDirectoriesBacktraces() const;
std::vector<std::string> GetCompileOptionsEntries() const;
std::vector<cmListFileBacktrace> GetCompileOptionsBacktraces() const;
std::vector<std::string> GetCompileDefinitionsEntries() const;
std::vector<cmListFileBacktrace> GetCompileDefinitionsBacktraces() const;
cmStringRange GetIncludeDirectoriesEntries() const;
cmBacktraceRange GetIncludeDirectoriesBacktraces() const;
cmStringRange GetCompileOptionsEntries() const;
cmBacktraceRange GetCompileOptionsBacktraces() const;
cmStringRange GetCompileDefinitionsEntries() const;
cmBacktraceRange GetCompileDefinitionsBacktraces() const;
bool IsConfigured() const { return this->Configured; }
void SetConfigured(){ this->Configured = true; }

View File

@ -402,14 +402,13 @@ void cmTarget::SetMakefile(cmMakefile* mf)
{
// Initialize the INCLUDE_DIRECTORIES property based on the current value
// of the same directory property:
const std::vector<std::string> parentIncludes =
const cmStringRange parentIncludes =
this->Makefile->GetIncludeDirectoriesEntries();
const std::vector<cmListFileBacktrace> parentIncludesBts =
const cmBacktraceRange parentIncludesBts =
this->Makefile->GetIncludeDirectoriesBacktraces();
std::vector<cmListFileBacktrace>::const_iterator btIt =
parentIncludesBts.begin();
for (std::vector<std::string>::const_iterator it
cmBacktraceRange::const_iterator btIt = parentIncludesBts.begin();
for (cmStringRange::const_iterator it
= parentIncludes.begin();
it != parentIncludes.end(); ++it, ++btIt)
{
@ -421,13 +420,13 @@ void cmTarget::SetMakefile(cmMakefile* mf)
this->SystemIncludeDirectories.insert(parentSystemIncludes.begin(),
parentSystemIncludes.end());
const std::vector<std::string> parentOptions =
const cmStringRange parentOptions =
this->Makefile->GetCompileOptionsEntries();
const std::vector<cmListFileBacktrace> parentOptionsBts =
const cmBacktraceRange parentOptionsBts =
this->Makefile->GetCompileOptionsBacktraces();
btIt = parentOptionsBts.begin();
for (std::vector<std::string>::const_iterator it
for (cmStringRange::const_iterator it
= parentOptions.begin();
it != parentOptions.end(); ++it, ++btIt)
{