summaryrefslogtreecommitdiffstats
path: root/Source/cmSourceFile.cxx
diff options
context:
space:
mode:
authorTushar Maheshwari <tushar27192@gmail.com>2019-08-27 16:05:42 (GMT)
committerTushar Maheshwari <tushar27192@gmail.com>2019-08-27 16:05:42 (GMT)
commit8cb3cffa42e11c2508ed8db703f2f9a1a73fbbb9 (patch)
tree88c3d054322f1e36ac67958e7da8c88897baaa82 /Source/cmSourceFile.cxx
parent65fe80794d41ab6f0b1e608d7535b7530a2ff51d (diff)
downloadCMake-8cb3cffa42e11c2508ed8db703f2f9a1a73fbbb9.zip
CMake-8cb3cffa42e11c2508ed8db703f2f9a1a73fbbb9.tar.gz
CMake-8cb3cffa42e11c2508ed8db703f2f9a1a73fbbb9.tar.bz2
cmSourceFile: Rename non-const GetLanguage
GetOrDetermineLanguage: - Read the property if available - Determine the Language using the file extension Fix all usage of the non-const member in the repository.
Diffstat (limited to 'Source/cmSourceFile.cxx')
-rw-r--r--Source/cmSourceFile.cxx19
1 files changed, 8 insertions, 11 deletions
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx
index a6d2807..738a1c0 100644
--- a/Source/cmSourceFile.cxx
+++ b/Source/cmSourceFile.cxx
@@ -45,11 +45,13 @@ std::string cmSourceFile::GetObjectLibrary() const
return this->ObjectLibrary;
}
-std::string cmSourceFile::GetLanguage()
+std::string const& cmSourceFile::GetOrDetermineLanguage()
{
// If the language was set explicitly by the user then use it.
if (const char* lang = this->GetProperty(propLANGUAGE)) {
- return lang;
+ // Assign to member in order to return a reference.
+ this->Language = lang;
+ return this->Language;
}
// Perform computation needed to get the language if necessary.
@@ -72,8 +74,8 @@ std::string cmSourceFile::GetLanguage()
}
}
- // Now try to determine the language.
- return static_cast<cmSourceFile const*>(this)->GetLanguage();
+ // Use the language determined from the file extension.
+ return this->Language;
}
std::string cmSourceFile::GetLanguage() const
@@ -83,13 +85,8 @@ std::string cmSourceFile::GetLanguage() const
return lang;
}
- // If the language was determined from the source file extension use it.
- if (!this->Language.empty()) {
- return this->Language;
- }
-
- // The language is not known.
- return "";
+ // Use the language determined from the file extension.
+ return this->Language;
}
cmSourceFileLocation const& cmSourceFile::GetLocation() const