cmSourceFileLocation: Use a const cmMakefile.

This commit is contained in:
Stephen Kelly 2014-01-21 17:07:59 +01:00
parent b33ea5783a
commit b629240236
2 changed files with 6 additions and 6 deletions

View File

@ -18,7 +18,7 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmSourceFileLocation cmSourceFileLocation
::cmSourceFileLocation(cmMakefile* mf, const char* name): Makefile(mf) ::cmSourceFileLocation(cmMakefile const* mf, const char* name): Makefile(mf)
{ {
this->AmbiguousDirectory = !cmSystemTools::FileIsFullPath(name); this->AmbiguousDirectory = !cmSystemTools::FileIsFullPath(name);
this->AmbiguousExtension = true; this->AmbiguousExtension = true;
@ -89,7 +89,7 @@ void cmSourceFileLocation::UpdateExtension(const char* name)
// The global generator checks extensions of enabled languages. // The global generator checks extensions of enabled languages.
cmGlobalGenerator* gg = cmGlobalGenerator* gg =
this->Makefile->GetLocalGenerator()->GetGlobalGenerator(); this->Makefile->GetLocalGenerator()->GetGlobalGenerator();
cmMakefile* mf = this->Makefile; cmMakefile const* mf = this->Makefile;
const std::vector<std::string>& srcExts = mf->GetSourceExtensions(); const std::vector<std::string>& srcExts = mf->GetSourceExtensions();
const std::vector<std::string>& hdrExts = mf->GetHeaderExtensions(); const std::vector<std::string>& hdrExts = mf->GetHeaderExtensions();
if(gg->GetLanguageFromExtension(ext.c_str()) || if(gg->GetLanguageFromExtension(ext.c_str()) ||
@ -170,7 +170,7 @@ cmSourceFileLocation
// Only a fixed set of extensions will be tried to match a file on // Only a fixed set of extensions will be tried to match a file on
// disk. One of these must match if loc refers to this source file. // disk. One of these must match if loc refers to this source file.
std::string ext = this->Name.substr(loc.Name.size()+1); std::string ext = this->Name.substr(loc.Name.size()+1);
cmMakefile* mf = this->Makefile; cmMakefile const* mf = this->Makefile;
const std::vector<std::string>& srcExts = mf->GetSourceExtensions(); const std::vector<std::string>& srcExts = mf->GetSourceExtensions();
if(std::find(srcExts.begin(), srcExts.end(), ext) != srcExts.end()) if(std::find(srcExts.begin(), srcExts.end(), ext) != srcExts.end())
{ {

View File

@ -33,7 +33,7 @@ public:
* Construct for a source file created in a given cmMakefile * Construct for a source file created in a given cmMakefile
* instance with an initial name. * instance with an initial name.
*/ */
cmSourceFileLocation(cmMakefile* mf, const char* name); cmSourceFileLocation(cmMakefile const* mf, const char* name);
/** /**
* Return whether the givne source file location could refers to the * Return whether the givne source file location could refers to the
@ -81,9 +81,9 @@ public:
/** /**
* Get the cmMakefile instance for which the source file was created. * Get the cmMakefile instance for which the source file was created.
*/ */
cmMakefile* GetMakefile() const { return this->Makefile; } cmMakefile const* GetMakefile() const { return this->Makefile; }
private: private:
cmMakefile* Makefile; cmMakefile const* Makefile;
bool AmbiguousDirectory; bool AmbiguousDirectory;
bool AmbiguousExtension; bool AmbiguousExtension;
std::string Directory; std::string Directory;