summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2014-03-12 22:50:42 (GMT)
committerStephen Kelly <steveire@gmail.com>2014-03-13 14:27:23 (GMT)
commitc725bb3cbd51edd4043f81d01b7a01bbd42adb2f (patch)
treeb4bfc2adbb46ea55af5bae98273d20b8cc0ec171 /Source
parentdcfcd23ed53d3bfe8ef299b8a3a38c47c27fa6b6 (diff)
downloadCMake-c725bb3cbd51edd4043f81d01b7a01bbd42adb2f.zip
CMake-c725bb3cbd51edd4043f81d01b7a01bbd42adb2f.tar.gz
CMake-c725bb3cbd51edd4043f81d01b7a01bbd42adb2f.tar.bz2
Constify some APIs in generators.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx2
-rw-r--r--Source/cmGlobalVisualStudio10Generator.h4
-rw-r--r--Source/cmMakefileTargetGenerator.cxx9
-rw-r--r--Source/cmMakefileTargetGenerator.h9
-rw-r--r--Source/cmNinjaTargetGenerator.cxx10
-rw-r--r--Source/cmNinjaTargetGenerator.h10
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx11
-rw-r--r--Source/cmVisualStudio10TargetGenerator.h13
8 files changed, 36 insertions, 32 deletions
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 840e888..37a416b 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -470,7 +470,7 @@ cmGlobalVisualStudio10Generator
//----------------------------------------------------------------------------
void cmGlobalVisualStudio10Generator::PathTooLong(
- cmTarget* target, cmSourceFile* sf, std::string const& sfRel)
+ cmTarget* target, cmSourceFile const* sf, std::string const& sfRel)
{
size_t len = (strlen(target->GetMakefile()->GetCurrentOutputDirectory()) +
1 + sfRel.length());
diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h
index 999a9d5..ede6b1b 100644
--- a/Source/cmGlobalVisualStudio10Generator.h
+++ b/Source/cmGlobalVisualStudio10Generator.h
@@ -87,7 +87,7 @@ public:
/** Generate an <output>.rule file path for a given command output. */
virtual std::string GenerateRuleFile(std::string const& output) const;
- void PathTooLong(cmTarget* target, cmSourceFile* sf,
+ void PathTooLong(cmTarget* target, cmSourceFile const* sf,
std::string const& sfRel);
virtual const char* GetToolsVersion() { return "4.0"; }
@@ -112,7 +112,7 @@ private:
LongestSourcePath(): Length(0), Target(0), SourceFile(0) {}
size_t Length;
cmTarget* Target;
- cmSourceFile* SourceFile;
+ cmSourceFile const* SourceFile;
std::string SourceRel;
};
LongestSourcePath LongestSource;
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index fdca7f7..32e1c1a 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -423,7 +423,8 @@ cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator()
}
//----------------------------------------------------------------------------
-void cmMakefileTargetGenerator::WriteObjectRuleFiles(cmSourceFile& source)
+void cmMakefileTargetGenerator
+::WriteObjectRuleFiles(cmSourceFile const& source)
{
// Identify the language of the source file.
const std::string& lang =
@@ -498,7 +499,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(cmSourceFile& source)
//----------------------------------------------------------------------------
void
cmMakefileTargetGenerator
-::AppendFortranFormatFlags(std::string& flags, cmSourceFile& source)
+::AppendFortranFormatFlags(std::string& flags, cmSourceFile const& source)
{
const char* srcfmt = source.GetProperty("Fortran_FORMAT");
cmLocalGenerator::FortranFormat format =
@@ -529,7 +530,7 @@ void
cmMakefileTargetGenerator
::WriteObjectBuildFile(std::string &obj,
const std::string& lang,
- cmSourceFile& source,
+ cmSourceFile const& source,
std::vector<std::string>& depends)
{
this->LocalGenerator->AppendRuleDepend(depends,
@@ -1194,7 +1195,7 @@ cmMakefileTargetGenerator
//----------------------------------------------------------------------------
void cmMakefileTargetGenerator
-::WriteObjectDependRules(cmSourceFile& source,
+::WriteObjectDependRules(cmSourceFile const& source,
std::vector<std::string>& depends)
{
// Create the list of dependencies known at cmake time. These are
diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h
index f59bd9b..7ff6da9 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -89,16 +89,16 @@ protected:
friend struct MacOSXContentGeneratorType;
// write the rules for an object
- void WriteObjectRuleFiles(cmSourceFile& source);
+ void WriteObjectRuleFiles(cmSourceFile const& source);
// write the build rule for an object
void WriteObjectBuildFile(std::string &obj,
const std::string& lang,
- cmSourceFile& source,
+ cmSourceFile const& source,
std::vector<std::string>& depends);
// write the depend.make file for an object
- void WriteObjectDependRules(cmSourceFile& source,
+ void WriteObjectDependRules(cmSourceFile const& source,
std::vector<std::string>& depends);
// write the build rule for a custom command
@@ -126,7 +126,8 @@ protected:
// Return the a string with -F flags on apple
std::string GetFrameworkFlags(std::string const& l);
- void AppendFortranFormatFlags(std::string& flags, cmSourceFile& source);
+ void AppendFortranFormatFlags(std::string& flags,
+ cmSourceFile const& source);
// append intertarget dependencies
void AppendTargetDepends(std::vector<std::string>& depends);
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 149b129..3738ca7 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -126,7 +126,7 @@ void cmNinjaTargetGenerator::AddFeatureFlags(std::string& flags,
// void cmMakefileTargetGenerator::WriteTargetLanguageFlags()
// Refactor it.
std::string
-cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile *source,
+cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile const* source,
const std::string& language)
{
// TODO: Fortran support.
@@ -211,7 +211,7 @@ bool cmNinjaTargetGenerator::needsDepFile(const std::string& lang)
// void cmMakefileTargetGenerator::WriteTargetLanguageFlags().
std::string
cmNinjaTargetGenerator::
-ComputeDefines(cmSourceFile *source, const std::string& language)
+ComputeDefines(cmSourceFile const* source, const std::string& language)
{
std::set<std::string> defines;
@@ -269,14 +269,14 @@ cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const
std::string
cmNinjaTargetGenerator
-::GetSourceFilePath(cmSourceFile* source) const
+::GetSourceFilePath(cmSourceFile const* source) const
{
return ConvertToNinjaPath(source->GetFullPath().c_str());
}
std::string
cmNinjaTargetGenerator
-::GetObjectFilePath(cmSourceFile* source) const
+::GetObjectFilePath(cmSourceFile const* source) const
{
std::string path = this->LocalGenerator->GetHomeRelativeOutputPath();
if(!path.empty())
@@ -536,7 +536,7 @@ cmNinjaTargetGenerator
void
cmNinjaTargetGenerator
-::WriteObjectBuildStatement(cmSourceFile* source)
+::WriteObjectBuildStatement(cmSourceFile const* source)
{
std::string comment;
const std::string language = source->GetLanguage();
diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h
index 900e2bd..8669e6e 100644
--- a/Source/cmNinjaTargetGenerator.h
+++ b/Source/cmNinjaTargetGenerator.h
@@ -79,10 +79,10 @@ protected:
* @note Generally it is the value of the variable whose name is computed
* by LanguageFlagsVarName().
*/
- std::string ComputeFlagsForObject(cmSourceFile *source,
+ std::string ComputeFlagsForObject(cmSourceFile const* source,
const std::string& language);
- std::string ComputeDefines(cmSourceFile *source,
+ std::string ComputeDefines(cmSourceFile const* source,
const std::string& language);
std::string ConvertToNinjaPath(const char *path) const {
@@ -96,10 +96,10 @@ protected:
cmNinjaDeps ComputeLinkDeps() const;
/// @return the source file path for the given @a source.
- std::string GetSourceFilePath(cmSourceFile* source) const;
+ std::string GetSourceFilePath(cmSourceFile const* source) const;
/// @return the object file path for the given @a source.
- std::string GetObjectFilePath(cmSourceFile* source) const;
+ std::string GetObjectFilePath(cmSourceFile const* source) const;
/// @return the file path where the target named @a name is generated.
std::string GetTargetFilePath(const std::string& name) const;
@@ -110,7 +110,7 @@ protected:
void WriteLanguageRules(const std::string& language);
void WriteCompileRule(const std::string& language);
void WriteObjectBuildStatements();
- void WriteObjectBuildStatement(cmSourceFile* source);
+ void WriteObjectBuildStatement(cmSourceFile const* source);
void WriteCustomCommandBuildStatement(cmCustomCommand *cc);
cmNinjaDeps GetObjects() const
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 7c55f64..cc1fdbc 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -562,7 +562,8 @@ void cmVisualStudio10TargetGenerator::WriteCustomCommands()
}
//----------------------------------------------------------------------------
-void cmVisualStudio10TargetGenerator::WriteCustomCommand(cmSourceFile* sf)
+void cmVisualStudio10TargetGenerator
+::WriteCustomCommand(cmSourceFile const* sf)
{
if(this->SourcesVisited.insert(sf).second)
{
@@ -585,7 +586,7 @@ void cmVisualStudio10TargetGenerator::WriteCustomCommand(cmSourceFile* sf)
}
void
-cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source,
+cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile const* source,
cmCustomCommand const &
command)
{
@@ -928,7 +929,7 @@ WriteGroupSources(const char* name,
}
void cmVisualStudio10TargetGenerator::WriteSource(
- const char* tool, cmSourceFile* sf, const char* end)
+ const char* tool, cmSourceFile const* sf, const char* end)
{
// Visual Studio tools append relative paths to the current dir, as in:
//
@@ -1091,9 +1092,9 @@ void cmVisualStudio10TargetGenerator::WriteAllSources()
}
bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
- cmSourceFile* source)
+ cmSourceFile const* source)
{
- cmSourceFile& sf = *source;
+ cmSourceFile const& sf = *source;
std::string objectName;
if(this->GeneratorTarget->HasExplicitObjectName(&sf))
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index 02b951c..8faeb8e 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -45,7 +45,7 @@ public:
private:
struct ToolSource
{
- cmSourceFile* SourceFile;
+ cmSourceFile const* SourceFile;
bool RelativePath;
};
struct ToolSources: public std::vector<ToolSource> {};
@@ -55,7 +55,8 @@ private:
void WriteString(const char* line, int indentLevel);
void WriteProjectConfigurations();
void WriteProjectConfigurationValues();
- void WriteSource(const char* tool, cmSourceFile* sf, const char* end = 0);
+ void WriteSource(const char* tool, cmSourceFile const* sf,
+ const char* end = 0);
void WriteSources(const char* tool, std::vector<cmSourceFile*> const&);
void WriteAllSources();
void WriteDotNetReferences();
@@ -77,13 +78,13 @@ private:
std::vector<std::string> const & includes);
void OutputIncludes(std::vector<std::string> const & includes);
void OutputLinkIncremental(std::string const& configName);
- void WriteCustomRule(cmSourceFile* source,
+ void WriteCustomRule(cmSourceFile const* source,
cmCustomCommand const & command);
void WriteCustomCommands();
- void WriteCustomCommand(cmSourceFile* sf);
+ void WriteCustomCommand(cmSourceFile const* sf);
void WriteGroups();
void WriteProjectReferences();
- bool OutputSourceSpecificFlags(cmSourceFile* source);
+ bool OutputSourceSpecificFlags(cmSourceFile const* source);
void AddLibraries(cmComputeLinkInformation& cli, std::string& libstring);
void WriteLibOptions(std::string const& config);
void WriteEvents(std::string const& configName);
@@ -111,7 +112,7 @@ private:
cmGlobalVisualStudio10Generator* GlobalGenerator;
cmGeneratedFileStream* BuildFileStream;
cmLocalVisualStudio7Generator* LocalGenerator;
- std::set<cmSourceFile*> SourcesVisited;
+ std::set<cmSourceFile const*> SourcesVisited;
typedef std::map<std::string, ToolSources> ToolSourceMap;
ToolSourceMap Tools;