Commit ce511435 authored by Ben Boeckel's avatar Ben Boeckel Committed by Brad King

stringapi: Use strings for the languages

parent 83a5e453
......@@ -268,7 +268,7 @@ cmComputeLinkInformation
// Get the language used for linking this target.
this->LinkLanguage = this->Target->GetLinkerLanguage(config, headTarget);
if(!this->LinkLanguage)
if(this->LinkLanguage.empty())
{
// The Compute method will do nothing, so skip the rest of the
// initialization.
......@@ -496,7 +496,7 @@ bool cmComputeLinkInformation::Compute()
}
// We require a link language for the target.
if(!this->LinkLanguage)
if(this->LinkLanguage.empty())
{
cmSystemTools::
Error("CMake can not determine linker language for target: ",
......
......@@ -50,7 +50,7 @@ public:
std::vector<std::string> const& GetDirectories();
std::vector<std::string> const& GetDepends();
std::vector<std::string> const& GetFrameworkPaths();
const char* GetLinkLanguage() const { return this->LinkLanguage; }
std::string GetLinkLanguage() const { return this->LinkLanguage; }
std::vector<std::string> const& GetRuntimeSearchPath();
std::string const& GetRuntimeFlag() const { return this->RuntimeFlag; }
std::string const& GetRuntimeSep() const { return this->RuntimeSep; }
......@@ -83,7 +83,7 @@ private:
// Configuration information.
const char* Config;
const char* LinkLanguage;
std::string LinkLanguage;
bool LinkDependsNoShared;
// Modes for dealing with dependent shared libraries.
......
......@@ -249,7 +249,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
si != sources.end(); ++si)
{
std::string ext = cmSystemTools::GetFilenameLastExtension(*si);
if(const char* lang = gg->GetLanguageFromExtension(ext.c_str()))
std::string lang = gg->GetLanguageFromExtension(ext.c_str());
if(!lang.empty())
{
testLangs.insert(lang);
}
......
......@@ -297,7 +297,7 @@ bool cmDepends::CheckDependencies(std::istream& internalDepends,
}
//----------------------------------------------------------------------------
void cmDepends::SetIncludePathFromLanguage(const char* lang)
void cmDepends::SetIncludePathFromLanguage(const std::string& lang)
{
// Look for the new per "TARGET_" variant first:
const char * includePath = 0;
......
......@@ -41,7 +41,7 @@ public:
void SetLocalGenerator(cmLocalGenerator* lg) { this->LocalGenerator = lg; }
/** Set the specific language to be scanned. */
void SetLanguage(const char* lang) { this->Language = lang; }
void SetLanguage(const std::string& lang) { this->Language = lang; }
/** Set the target build directory. */
void SetTargetDirectory(const char* dir) { this->TargetDirectory = dir; }
......@@ -114,7 +114,7 @@ protected:
// The include file search path.
std::vector<std::string> IncludePath;
void SetIncludePathFromLanguage(const char* lang);
void SetIncludePathFromLanguage(const std::string& lang);
private:
cmDepends(cmDepends const&); // Purposely not implemented.
......
......@@ -37,7 +37,7 @@ cmDependsC::cmDependsC()
//----------------------------------------------------------------------------
cmDependsC::cmDependsC(cmLocalGenerator* lg,
const char* targetDir,
const char* lang,
const std::string& lang,
const std::map<std::string, DependencyVector>* validDeps)
: cmDepends(lg, targetDir)
, ValidDeps(validDeps)
......
......@@ -25,7 +25,8 @@ public:
/** Checking instances need to know the build directory name and the
relative path from the build directory to the target file. */
cmDependsC();
cmDependsC(cmLocalGenerator* lg, const char* targetDir, const char* lang,
cmDependsC(cmLocalGenerator* lg, const char* targetDir,
const std::string& lang,
const std::map<std::string, DependencyVector>* validDeps);
/** Virtual destructor to cleanup subclasses properly. */
......
......@@ -411,7 +411,8 @@ void cmExtraCodeBlocksGenerator
// check whether it is a C/C++ implementation file
bool isCFile = false;
if ((*si)->GetLanguage() && (*(*si)->GetLanguage() == 'C'))
std::string lang = (*si)->GetLanguage();
if (lang == "C" || lang == "CXX")
{
for(std::vector<std::string>::const_iterator
ext = mf->GetSourceExtensions().begin();
......
......@@ -220,7 +220,8 @@ void cmExtraCodeLiteGenerator
{
// check whether it is a C/C++ implementation file
bool isCFile = false;
if ((*si)->GetLanguage() && (*(*si)->GetLanguage() == 'C'))
std::string lang = (*si)->GetLanguage();
if (lang == "C" || lang == "CXX")
{
for(std::vector<std::string>::const_iterator
ext = mf->GetSourceExtensions().begin();
......
......@@ -369,8 +369,8 @@ cmExtraSublimeTextGenerator::ComputeFlagsForObject(cmSourceFile* source,
std::string flags;
cmMakefile *makefile = lg->GetMakefile();
const char* language = source->GetLanguage();
if (language == NULL)
std::string language = source->GetLanguage();
if (language.empty())
{
language = "C";
}
......@@ -423,11 +423,7 @@ ComputeDefines(cmSourceFile *source, cmLocalGenerator* lg, cmTarget *target,
{
std::set<std::string> defines;
cmMakefile *makefile = lg->GetMakefile();
const char* language = source->GetLanguage();
if (language == NULL)
{
language = "";
}
const std::string& language = source->GetLanguage();
const char* config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
// Add the export symbol definition for shared library objects.
......
......@@ -990,8 +990,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
"link libraries for a static library");
return std::string();
}
const char *lang = target->GetLinkerLanguage(context->Config);
return lang ? lang : "";
return target->GetLinkerLanguage(context->Config);
}
cmGeneratorExpressionDAGChecker dagChecker(context->Backtrace,
......
......@@ -168,7 +168,7 @@ struct TagVisitor
this->BadObjLibFiles.push_back(sf);
}
}
else if(sf->GetLanguage())
else if(!sf->GetLanguage().empty())
{
DoAccept<IsSameTag<Tag, ObjectSourcesTag>::Result>::Do(this->Data, sf);
}
......
......@@ -35,7 +35,7 @@ bool cmGetSourceFilePropertyCommand
{
if(args[2] == "LANGUAGE")
{
this->Makefile->AddDefinition(var, sf->GetLanguage());
this->Makefile->AddDefinition(var, sf->GetLanguage().c_str());
return true;
}
const char *prop = sf->GetPropertyForUser(args[2].c_str());
......
......@@ -722,7 +722,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
//----------------------------------------------------------------------------
void cmGlobalGenerator::PrintCompilerAdvice(std::ostream& os,
std::string lang,
std::string const& lang,
const char* envVar) const
{
// Subclasses override this method if they do not support this advice.
......@@ -744,7 +744,7 @@ void cmGlobalGenerator::PrintCompilerAdvice(std::ostream& os,
//----------------------------------------------------------------------------
void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf,
std::string lang) const
std::string const& lang) const
{
std::string compilerIdVar = "CMAKE_" + lang + "_COMPILER_ID";
const char* compilerId = mf->GetDefinition(compilerIdVar.c_str());
......@@ -817,17 +817,18 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf,
}
//----------------------------------------------------------------------------
const char*
std::string
cmGlobalGenerator::GetLanguageOutputExtension(cmSourceFile const& source) const
{
if(const char* lang = source.GetLanguage())
const std::string& lang = source.GetLanguage();
if(!lang.empty())
{
std::map<cmStdString, cmStdString>::const_iterator it =
this->LanguageToOutputExtension.find(lang);
if(it != this->LanguageToOutputExtension.end())
{
return it->second.c_str();
return it->second;
}
}
else
......@@ -840,7 +841,7 @@ cmGlobalGenerator::GetLanguageOutputExtension(cmSourceFile const& source) const
{
if(this->OutputExtensions.count(ext))
{
return ext.c_str();
return ext;
}
}
}
......@@ -848,7 +849,7 @@ cmGlobalGenerator::GetLanguageOutputExtension(cmSourceFile const& source) const
}
const char* cmGlobalGenerator::GetLanguageFromExtension(const char* ext) const
std::string cmGlobalGenerator::GetLanguageFromExtension(const char* ext) const
{
// if there is an extension and it starts with . then move past the
// . because the extensions are not stored with a . in the map
......@@ -860,9 +861,9 @@ const char* cmGlobalGenerator::GetLanguageFromExtension(const char* ext) const
= this->ExtensionToLanguage.find(ext);
if(it != this->ExtensionToLanguage.end())
{
return it->second.c_str();
return it->second;
}
return 0;
return "";
}
/* SetLanguageEnabled() is now split in two parts:
......@@ -877,13 +878,15 @@ files could change the object file extension
(CMAKE_<LANG>_OUTPUT_EXTENSION) before the CMake variables were copied
to the C++ maps.
*/
void cmGlobalGenerator::SetLanguageEnabled(const char* l, cmMakefile* mf)
void cmGlobalGenerator::SetLanguageEnabled(const std::string& l,
cmMakefile* mf)
{
this->SetLanguageEnabledFlag(l, mf);
this->SetLanguageEnabledMaps(l, mf);
}
void cmGlobalGenerator::SetLanguageEnabledFlag(const char* l, cmMakefile* mf)
void cmGlobalGenerator::SetLanguageEnabledFlag(const std::string& l,
cmMakefile* mf)
{
this->LanguageEnabled[l] = true;
......@@ -895,7 +898,8 @@ void cmGlobalGenerator::SetLanguageEnabledFlag(const char* l, cmMakefile* mf)
this->FillExtensionToLanguageMap(l, mf);
}
void cmGlobalGenerator::SetLanguageEnabledMaps(const char* l, cmMakefile* mf)
void cmGlobalGenerator::SetLanguageEnabledMaps(const std::string& l,
cmMakefile* mf)
{
// use LanguageToLinkerPreference to detect whether this functions has
// run before
......@@ -969,7 +973,7 @@ void cmGlobalGenerator::SetLanguageEnabledMaps(const char* l, cmMakefile* mf)
}
void cmGlobalGenerator::FillExtensionToLanguageMap(const char* l,
void cmGlobalGenerator::FillExtensionToLanguageMap(const std::string& l,
cmMakefile* mf)
{
std::string extensionsVar = std::string("CMAKE_") +
......@@ -986,14 +990,14 @@ void cmGlobalGenerator::FillExtensionToLanguageMap(const char* l,
bool cmGlobalGenerator::IgnoreFile(const char* l) const
{
if(this->GetLanguageFromExtension(l))
if(!this->GetLanguageFromExtension(l).empty())
{
return false;
}
return (this->IgnoreExtensions.count(l) > 0);
}
bool cmGlobalGenerator::GetLanguageEnabled(const char* l) const
bool cmGlobalGenerator::GetLanguageEnabled(const std::string& l) const
{
return (this->LanguageEnabled.find(l)!= this->LanguageEnabled.end());
}
......@@ -1958,7 +1962,7 @@ cmGlobalGenerator::GetEnabledLanguages(std::vector<std::string>& lang) const
}
}
int cmGlobalGenerator::GetLinkerPreference(const char* lang) const
int cmGlobalGenerator::GetLinkerPreference(const std::string& lang) const
{
std::map<cmStdString, int>::const_iterator it =
this->LanguageToLinkerPreference.find(lang);
......
......@@ -77,8 +77,8 @@ public:
/**
* Set/Get and Clear the enabled languages.
*/
void SetLanguageEnabled(const char*, cmMakefile* mf);
bool GetLanguageEnabled(const char*) const;
void SetLanguageEnabled(const std::string&, cmMakefile* mf);
bool GetLanguageEnabled(const std::string&) const;
void ClearEnabledLanguages();
void GetEnabledLanguages(std::vector<std::string>& lang) const;
/**
......@@ -182,13 +182,13 @@ public:
bool GetToolSupportsColor() const { return this->ToolSupportsColor; }
///! return the language for the given extension
const char* GetLanguageFromExtension(const char* ext) const;
std::string GetLanguageFromExtension(const char* ext) const;
///! is an extension to be ignored
bool IgnoreFile(const char* ext) const;
///! What is the preference for linkers and this language (None or Prefered)
int GetLinkerPreference(const char* lang) const;
int GetLinkerPreference(const std::string& lang) const;
///! What is the object file extension for a given source file?
const char* GetLanguageOutputExtension(cmSourceFile const&) const;
std::string GetLanguageOutputExtension(cmSourceFile const&) const;
///! What is the configurations directory variable called?
virtual const char* GetCMakeCFGIntDir() const { return "."; }
......@@ -332,9 +332,9 @@ protected:
bool IsRootOnlyTarget(cmTarget* target) const;
void AddTargetDepends(cmTarget const* target,
TargetDependSet& projectTargets);
void SetLanguageEnabledFlag(const char* l, cmMakefile* mf);
void SetLanguageEnabledMaps(const char* l, cmMakefile* mf);
void FillExtensionToLanguageMap(const char* l, cmMakefile* mf);
void SetLanguageEnabledFlag(const std::string& l, cmMakefile* mf);
void SetLanguageEnabledMaps(const std::string& l, cmMakefile* mf);
void FillExtensionToLanguageMap(const std::string& l, cmMakefile* mf);
virtual bool ComputeTargetDepends();
......@@ -420,9 +420,10 @@ private:
void WriteSummary(cmTarget* target);
void FinalizeTargetCompileInfo();
virtual void PrintCompilerAdvice(std::ostream& os, std::string lang,
virtual void PrintCompilerAdvice(std::ostream& os, std::string const& lang,
const char* envVar) const;
void CheckCompilerIdCompatibility(cmMakefile* mf, std::string lang) const;
void CheckCompilerIdCompatibility(cmMakefile* mf,
std::string const& lang) const;
cmExternalMakefileProjectGenerator* ExtraGenerator;
......
......@@ -114,7 +114,8 @@ protected:
private:
virtual std::string GetVSMakeProgram() = 0;
void PrintCompilerAdvice(std::ostream&, std::string, const char*) const {}
void PrintCompilerAdvice(std::ostream&, std::string const&,
const char*) const {}
void ComputeTargetObjects(cmGeneratorTarget* gt) const;
void FollowLinkDepends(cmTarget const* target,
......
......@@ -696,12 +696,8 @@ cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg,
flags += flagsBuild.GetString();
}
const char* lang =
std::string lang =
this->CurrentLocalGenerator->GetSourceFileLanguage(*sf);
if (!lang)
{
lang = "";
}
cmXCodeObject* buildFile =
this->CreateXCodeSourceFileFromPath(sf->GetFullPath(), cmtarget, lang);
......@@ -906,12 +902,8 @@ cmXCodeObject*
cmGlobalXCodeGenerator::CreateXCodeFileReference(cmSourceFile* sf,
cmTarget& cmtarget)
{
const char* lang =
std::string lang =
this->CurrentLocalGenerator->GetSourceFileLanguage(*sf);
if (!lang)
{
lang = "";
}
return this->CreateXCodeFileReferenceFromPath(
sf->GetFullPath(), cmtarget, lang);
......@@ -1036,7 +1028,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
// Include this file in the build if it has a known language
// and has not been listed as an ignored extension for this
// generator.
if(this->CurrentLocalGenerator->GetSourceFileLanguage(**i) &&
if(!this->CurrentLocalGenerator->GetSourceFileLanguage(**i).empty() &&
!this->IgnoreFile((*i)->GetExtension().c_str()))
{
sourceFiles.push_back(xsf);
......@@ -1241,8 +1233,8 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmTarget& cmtarget)
return;
}
const char* llang = cmtarget.GetLinkerLanguage("NOCONFIG");
if(!llang) { return; }
std::string llang = cmtarget.GetLinkerLanguage("NOCONFIG");
if(llang.empty()) { return; }
// If the language is compiled as a source trust Xcode to link with it.
cmTarget::LinkImplementation const* impl =
......@@ -1270,7 +1262,7 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmTarget& cmtarget)
}
if(cmSourceFile* sf = mf->GetOrCreateSource(fname.c_str()))
{
sf->SetProperty("LANGUAGE", llang);
sf->SetProperty("LANGUAGE", llang.c_str());
cmtarget.AddSourceFile(sf);
}
}
......@@ -1714,12 +1706,12 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
(target.GetType() == cmTarget::EXECUTABLE) ||
shared);
const char* lang = target.GetLinkerLanguage(configName);
std::string lang = target.GetLinkerLanguage(configName);
std::string cflags;
if(lang)
if(!lang.empty())
{
// for c++ projects get the c flags as well
if(strcmp(lang, "CXX") == 0)
if(lang == "CXX")
{
this->CurrentLocalGenerator->AddLanguageFlags(cflags, "C", configName);
this->CurrentLocalGenerator->AddCMP0018Flags(cflags, &target,
......@@ -2178,7 +2170,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
const char* debugStr = "YES";
// We can't set the Xcode flag differently depending on the language,
// so put them back in this case.
if( (lang && strcmp(lang, "CXX") == 0) && gflag != gflagc )
if( (lang == "CXX") && gflag != gflagc )
{
cflags += " ";
cflags += gflagc;
......@@ -2201,7 +2193,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
this->CreateString("NO"));
buildSettings->AddAttribute("GCC_INLINES_ARE_PRIVATE_EXTERN",
this->CreateString("NO"));
if(lang && strcmp(lang, "CXX") == 0)
if(lang == "CXX")
{
flags += " ";
flags += defFlags;
......@@ -3800,12 +3792,13 @@ cmGlobalXCodeGenerator
}
//----------------------------------------------------------------------------
std::string cmGlobalXCodeGenerator::LookupFlags(const char* varNamePrefix,
const char* varNameLang,
const char* varNameSuffix,
const char* default_flags)
std::string cmGlobalXCodeGenerator::LookupFlags(
const std::string& varNamePrefix,
const std::string& varNameLang,
const std::string& varNameSuffix,
const std::string& default_flags)
{
if(varNameLang)
if(!varNameLang.empty())
{
std::string varName = varNamePrefix;
varName += varNameLang;
......
......@@ -190,10 +190,10 @@ private:
void CreateReRunCMakeFile(cmLocalGenerator* root,
std::vector<cmLocalGenerator*> const& gens);
std::string LookupFlags(const char* varNamePrefix,
const char* varNameLang,
const char* varNameSuffix,
const char* default_flags);
std::string LookupFlags(const std::string& varNamePrefix,
const std::string& varNameLang,
const std::string& varNameSuffix,
const std::string& default_flags);
class Factory;
class BuildObjectListOrString;
......@@ -215,7 +215,8 @@ protected:
std::vector<cmXCodeObject*> XCodeObjects;
cmXCodeObject* RootObject;
private:
void PrintCompilerAdvice(std::ostream&, std::string, const char*) const {}
void PrintCompilerAdvice(std::ostream&, std::string const&,
const char*) const {}
void ComputeTargetObjects(cmGeneratorTarget* gt) const;
std::string GetObjectsNormalDirectory(
......
......@@ -572,7 +572,7 @@ void cmLocalGenerator::GenerateTargetManifest()
}
void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
const char* lang,
const std::string& lang,
cmSourceFile& source,
cmGeneratorTarget& target)
{
......@@ -604,7 +604,7 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
std::vector<std::string> commands;
cmSystemTools::ExpandList(rules, commands);
cmLocalGenerator::RuleVariables vars;
vars.Language = lang;
vars.Language = lang.c_str();
vars.Source = sourceFile.c_str();
vars.Object = objectFile.c_str();
vars.ObjectDir = objectDir.c_str();
......@@ -653,7 +653,7 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
);
}
void cmLocalGenerator::AddBuildTargetRule(const char* llang,
void cmLocalGenerator::AddBuildTargetRule(const std::string& llang,
cmGeneratorTarget& target)
{
cmStdString objs;
......@@ -703,7 +703,7 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang,
&target);
linkLibs = frameworkPath + linkPath + linkLibs;
cmLocalGenerator::RuleVariables vars;
vars.Language = llang;
vars.Language = llang.c_str();
vars.Objects = objs.c_str();
vars.ObjectDir = ".";
vars.Target = targetName.c_str();
......@@ -776,8 +776,8 @@ void cmLocalGenerator
case cmTarget::MODULE_LIBRARY:
case cmTarget::EXECUTABLE:
{
const char* llang = target.Target->GetLinkerLanguage();
if(!llang)
std::string llang = target.Target->GetLinkerLanguage();
if(llang.empty())
{
cmSystemTools::Error
("CMake can not determine linker language for target: ",
......@@ -1290,10 +1290,11 @@ cmLocalGenerator::ConvertToIncludeReference(std::string const& path,
std::string cmLocalGenerator::GetIncludeFlags(
const std::vector<std::string> &includes,
cmGeneratorTarget* target,
const char* lang, bool forResponseFile,
const std::string& lang,
bool forResponseFile,
const char *config)
{
if(!lang)
if(lang.empty())
{
return "";
}
......@@ -1415,7 +1416,7 @@ void cmLocalGenerator::AddCompileDefinitions(std::set<std::string>& defines,
//----------------------------------------------------------------------------
void cmLocalGenerator::AddCompileOptions(
std::string& flags, cmTarget* target,
const char* lang, const char* config
const std::string& lang, const char* config
)
{
std::string langFlagRegexVar = std::string("CMAKE_")+lang+"_FLAG_REGEX";
......@@ -1463,7 +1464,7 @@ void cmLocalGenerator::AddCompileOptions(
//----------------------------------------------------------------------------
void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
cmGeneratorTarget* target,
const char* lang,
const std::string& lang,
const char *config,
bool stripImplicitInclDirs
)
......@@ -1689,8 +1690,8 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
linkFlags += this->Makefile->GetSafeDefinition(build.c_str());
linkFlags += " ";
}
const char* linkLanguage = target->Target->GetLinkerLanguage();
if(!linkLanguage)
std::string linkLanguage = target->Target->GetLinkerLanguage();
if(linkLanguage.empty())
{
cmSystemTools::Error
("CMake can not determine linker language for target: ",
......@@ -1813,7 +1814,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
// Collect library linking flags command line options.
std::string linkLibs;
const char* linkLanguage = cli.GetLinkLanguage();
std::string linkLanguage = cli.GetLinkLanguage();
std::string libPathFlag =
this->Makefile->GetRequiredDefinition("CMAKE_LIBRARY_PATH_FLAG");
......@@ -1943,7 +1944,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
//----------------------------------------------------------------------------
void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
cmGeneratorTarget* target,
const char *lang,
const std::string& lang,
const char* config)
{
// Only add Mac OS X specific flags on Darwin platforms (OSX and iphone):
......@@ -1969,7 +1970,7 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
std::string("CMAKE_") + lang + "_OSX_DEPLOYMENT_TARGET_FLAG";
const char* deploymentTargetFlag =
this->Makefile->GetDefinition(deploymentTargetFlagVar.c_str());
if(!archs.empty() && lang && (lang[0] =='C' || lang[0] == 'F'))
if(!archs.empty() && !lang.empty() && (lang[0] =='C' || lang[0] == 'F'))
{
for(std::vector<std::string>::iterator i = archs.begin();
i != archs.end(); ++i)
......@@ -2000,7 +2001,7 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
//----------------------------------------------------------------------------
void cmLocalGenerator::AddLanguageFlags(std::string& flags,
const char* lang,
const std::string& lang,
const char* config)
{
// Add language-specific flags.
......@@ -2112,7 +2113,7 @@ bool cmLocalGenerator::GetRealDependency(const char* inName,
//----------------------------------------------------------------------------
void cmLocalGenerator::AddSharedFlags(std::string& flags,
const char* lang,
const std::string& lang,
bool shared)
{
std::string flagsVar;
......@@ -2128,7 +2129,8 @@ void cmLocalGenerator::AddSharedFlags(std::string& flags,
}
static void AddVisibilityCompileOption(std::string &flags, cmTarget* target,
cmLocalGenerator *lg, const char *lang)
cmLocalGenerator *lg,
const std::string& lang)
{
std::string l(lang);
std::string compileOption = "CMAKE_" + l + "_COMPILE_OPTIONS_VISIBILITY";
......@@ -2182,7 +2184,7 @@ static void AddInlineVisibilityCompileOption(std::string &flags,
//----------------------------------------------------------------------------
void cmLocalGenerator
::AddVisibilityPresetFlags(std::string &flags, cmTarget* target,
const char *lang)
const std::string& lang)
{
int targetType = target->GetType();
bool suitableTarget = ((targetType == cmTarget::SHARED_LIBRARY)
......@@ -2194,13 +2196,13 @@ void cmLocalGenerator
return;
}
if (!lang)
if (lang.empty())
{
return;
}
AddVisibilityCompileOption(flags, target, this, lang);
if(strcmp(lang, "CXX") == 0)
if(lang == "CXX")
{
AddInlineVisibilityCompileOption(flags, target, this);
}
......@@ -2396,11 +2398,11 @@ void cmLocalGenerator::AppendDefines(std::set<std::string>& defines,
//----------------------------------------------------------------------------
void cmLocalGenerator::JoinDefines(const std::set<std::string>& defines,
std::string &definesString,
const char* lang)
const std::string& lang)
{
// Lookup the define flag for the current language.
std::string dflag = "-D";
if(lang)
if(!lang.empty())
{
std::string defineFlagVar = "CMAKE_";
defineFlagVar += lang;
......@@ -2460,7 +2462,7 @@ void cmLocalGenerator::JoinDefines(const std::set<std::string>& defines,
//----------------------------------------------------------------------------
void cmLocalGenerator::AppendFeatureOptions(
std::string& flags, const char* lang, const char* feature)
std::string& flags, const std::string& lang, const char* feature)
{
std::string optVar = "CMAKE_";
optVar += lang;
......@@ -3140,7 +3142,8 @@ cmLocalGenerator
bool replaceExt = this->NeedBackwardsCompatibility_2_4();
if(!replaceExt)