cmDependsFortran: Simplify storage of preprocessor definitions
Collect the original preprocessor definitions in a std::set<> so that it can be copied directly by cmFortranParser's constructor instead of making a copy on the stack.
This commit is contained in:
parent
295480b923
commit
fd19445802
|
@ -65,7 +65,7 @@ struct cmFortranFile
|
||||||
struct cmFortranParser_s
|
struct cmFortranParser_s
|
||||||
{
|
{
|
||||||
cmFortranParser_s(std::vector<std::string> const& includes,
|
cmFortranParser_s(std::vector<std::string> const& includes,
|
||||||
std::set<std::string>& ppDefines,
|
std::set<std::string> const& defines,
|
||||||
cmFortranSourceInfo& info);
|
cmFortranSourceInfo& info);
|
||||||
~cmFortranParser_s();
|
~cmFortranParser_s();
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ public:
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
cmDependsFortran::cmDependsFortran():
|
cmDependsFortran::cmDependsFortran():
|
||||||
PPDefinitions(0), Internal(0)
|
Internal(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ cmDependsFortran
|
||||||
{
|
{
|
||||||
def = it->substr(0, assignment);
|
def = it->substr(0, assignment);
|
||||||
}
|
}
|
||||||
this->PPDefinitions.push_back(def);
|
this->PPDefinitions.insert(def);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,13 +198,9 @@ bool cmDependsFortran::WriteDependencies(
|
||||||
cmFortranSourceInfo& info =
|
cmFortranSourceInfo& info =
|
||||||
this->Internal->CreateObjectInfo(obj.c_str(), src.c_str());
|
this->Internal->CreateObjectInfo(obj.c_str(), src.c_str());
|
||||||
|
|
||||||
// Make a copy of the macros defined via ADD_DEFINITIONS
|
// Create the parser object. The constructor takes info by reference,
|
||||||
std::set<std::string> ppDefines(this->PPDefinitions.begin(),
|
// so we may look into the resulting objects later.
|
||||||
this->PPDefinitions.end());
|
cmFortranParser parser(this->IncludePath, this->PPDefinitions, info);
|
||||||
|
|
||||||
// Create the parser object. The constructor takes ppMacro and info per
|
|
||||||
// reference, so we may look into the resulting objects later.
|
|
||||||
cmFortranParser parser(this->IncludePath, ppDefines, info);
|
|
||||||
|
|
||||||
// Push on the starting file.
|
// Push on the starting file.
|
||||||
cmFortranParser_FilePush(&parser, src.c_str());
|
cmFortranParser_FilePush(&parser, src.c_str());
|
||||||
|
@ -931,9 +927,9 @@ bool cmFortranParser_s::FindIncludeFile(const char* dir,
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
cmFortranParser_s
|
cmFortranParser_s
|
||||||
::cmFortranParser_s(std::vector<std::string> const& includes,
|
::cmFortranParser_s(std::vector<std::string> const& includes,
|
||||||
std::set<std::string>& ppDefines,
|
std::set<std::string> const& defines,
|
||||||
cmFortranSourceInfo& info):
|
cmFortranSourceInfo& info):
|
||||||
IncludePath(includes), PPDefinitions(ppDefines), Info(info)
|
IncludePath(includes), PPDefinitions(defines), Info(info)
|
||||||
{
|
{
|
||||||
this->InInterface = 0;
|
this->InInterface = 0;
|
||||||
this->InPPFalseBranch = 0;
|
this->InPPFalseBranch = 0;
|
||||||
|
|
|
@ -73,7 +73,7 @@ protected:
|
||||||
// The source file from which to start scanning.
|
// The source file from which to start scanning.
|
||||||
std::string SourceFile;
|
std::string SourceFile;
|
||||||
|
|
||||||
std::vector<std::string> PPDefinitions;
|
std::set<std::string> PPDefinitions;
|
||||||
|
|
||||||
// Internal implementation details.
|
// Internal implementation details.
|
||||||
cmDependsFortranInternals* Internal;
|
cmDependsFortranInternals* Internal;
|
||||||
|
|
Loading…
Reference in New Issue