summaryrefslogtreecommitdiffstats
path: root/Source/cmDependsFortran.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-07-22 17:45:28 (GMT)
committerBrad King <brad.king@kitware.com>2015-07-27 13:45:35 (GMT)
commitfd1944580266c3c84234b28e2102fc787ed5c00d (patch)
tree0b7e6f7f86140e49fd422c676d2f0f48e6bc7551 /Source/cmDependsFortran.cxx
parent295480b923338de82bdaa965aed9960d582a1750 (diff)
downloadCMake-fd1944580266c3c84234b28e2102fc787ed5c00d.zip
CMake-fd1944580266c3c84234b28e2102fc787ed5c00d.tar.gz
CMake-fd1944580266c3c84234b28e2102fc787ed5c00d.tar.bz2
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.
Diffstat (limited to 'Source/cmDependsFortran.cxx')
-rw-r--r--Source/cmDependsFortran.cxx20
1 files changed, 8 insertions, 12 deletions
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx
index ea45e3c..a422a98 100644
--- a/Source/cmDependsFortran.cxx
+++ b/Source/cmDependsFortran.cxx
@@ -65,7 +65,7 @@ struct cmFortranFile
struct cmFortranParser_s
{
cmFortranParser_s(std::vector<std::string> const& includes,
- std::set<std::string>& ppDefines,
+ std::set<std::string> const& defines,
cmFortranSourceInfo& info);
~cmFortranParser_s();
@@ -129,7 +129,7 @@ public:
//----------------------------------------------------------------------------
cmDependsFortran::cmDependsFortran():
- PPDefinitions(0), Internal(0)
+ Internal(0)
{
}
@@ -162,7 +162,7 @@ cmDependsFortran
{
def = it->substr(0, assignment);
}
- this->PPDefinitions.push_back(def);
+ this->PPDefinitions.insert(def);
}
}
@@ -198,13 +198,9 @@ bool cmDependsFortran::WriteDependencies(
cmFortranSourceInfo& info =
this->Internal->CreateObjectInfo(obj.c_str(), src.c_str());
- // Make a copy of the macros defined via ADD_DEFINITIONS
- std::set<std::string> ppDefines(this->PPDefinitions.begin(),
- this->PPDefinitions.end());
-
- // 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);
+ // Create the parser object. The constructor takes info by reference,
+ // so we may look into the resulting objects later.
+ cmFortranParser parser(this->IncludePath, this->PPDefinitions, info);
// Push on the starting file.
cmFortranParser_FilePush(&parser, src.c_str());
@@ -931,9 +927,9 @@ bool cmFortranParser_s::FindIncludeFile(const char* dir,
//----------------------------------------------------------------------------
cmFortranParser_s
::cmFortranParser_s(std::vector<std::string> const& includes,
- std::set<std::string>& ppDefines,
+ std::set<std::string> const& defines,
cmFortranSourceInfo& info):
- IncludePath(includes), PPDefinitions(ppDefines), Info(info)
+ IncludePath(includes), PPDefinitions(defines), Info(info)
{
this->InInterface = 0;
this->InPPFalseBranch = 0;