diff options
author | Brad King <brad.king@kitware.com> | 2015-07-22 17:41:32 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-07-27 13:45:35 (GMT) |
commit | 295480b923338de82bdaa965aed9960d582a1750 (patch) | |
tree | cdad24870792ca3cdbbdbcb9f59ba3748ff75e19 | |
parent | 98b9645bcebf009643cff4e265cfcd31b56d80f5 (diff) | |
download | CMake-295480b923338de82bdaa965aed9960d582a1750.zip CMake-295480b923338de82bdaa965aed9960d582a1750.tar.gz CMake-295480b923338de82bdaa965aed9960d582a1750.tar.bz2 |
cmDependsFortran: Move FindIncludeFile method into parser class
This drops the only awareness of cmDependsFortran that cmFortranParser
needed.
-rw-r--r-- | Source/cmDependsFortran.cxx | 31 | ||||
-rw-r--r-- | Source/cmDependsFortran.h | 6 |
2 files changed, 17 insertions, 20 deletions
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index cbc8c8b..ea45e3c 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -64,13 +64,16 @@ struct cmFortranFile struct cmFortranParser_s { - cmFortranParser_s(cmDependsFortran* self, - std::set<std::string>& ppDefines, - cmFortranSourceInfo& info); + cmFortranParser_s(std::vector<std::string> const& includes, + std::set<std::string>& ppDefines, + cmFortranSourceInfo& info); ~cmFortranParser_s(); - // Pointer back to the main class. - cmDependsFortran* Self; + bool FindIncludeFile(const char* dir, const char* includeName, + std::string& fileName); + + // The include file search path. + std::vector<std::string> IncludePath; // Lexical scanner instance. yyscan_t Scanner; @@ -201,7 +204,7 @@ bool cmDependsFortran::WriteDependencies( // Create the parser object. The constructor takes ppMacro and info per // reference, so we may look into the resulting objects later. - cmFortranParser parser(this, ppDefines, info); + cmFortranParser parser(this->IncludePath, ppDefines, info); // Push on the starting file. cmFortranParser_FilePush(&parser, src.c_str()); @@ -885,9 +888,9 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, } //---------------------------------------------------------------------------- -bool cmDependsFortran::FindIncludeFile(const char* dir, - const char* includeName, - std::string& fileName) +bool cmFortranParser_s::FindIncludeFile(const char* dir, + const char* includeName, + std::string& fileName) { // If the file is a full path, include it directly. if(cmSystemTools::FileIsFullPath(includeName)) @@ -927,10 +930,10 @@ bool cmDependsFortran::FindIncludeFile(const char* dir, //---------------------------------------------------------------------------- cmFortranParser_s -::cmFortranParser_s(cmDependsFortran* self, - std::set<std::string>& ppDefines, - cmFortranSourceInfo& info): - Self(self), PPDefinitions(ppDefines), Info(info) +::cmFortranParser_s(std::vector<std::string> const& includes, + std::set<std::string>& ppDefines, + cmFortranSourceInfo& info): + IncludePath(includes), PPDefinitions(ppDefines), Info(info) { this->InInterface = 0; this->InPPFalseBranch = 0; @@ -1100,7 +1103,7 @@ void cmFortranParser_RuleInclude(cmFortranParser* parser, // problem because either the source will not compile or the user // does not care about depending on this included source. std::string fullName; - if(parser->Self->FindIncludeFile(dir.c_str(), name, fullName)) + if(parser->FindIncludeFile(dir.c_str(), name, fullName)) { // Found the included file. Save it in the set of included files. parser->Info.Includes.insert(fullName); diff --git a/Source/cmDependsFortran.h b/Source/cmDependsFortran.h index 9f28088..db2df19 100644 --- a/Source/cmDependsFortran.h +++ b/Source/cmDependsFortran.h @@ -46,12 +46,6 @@ public: static bool ModulesDiffer(const char* modFile, const char* stampFile, const char* compilerId); - /** Method to find an included file in the include path. Fortran - always searches the directory containing the including source - first. */ - bool FindIncludeFile(const char* dir, const char* includeName, - std::string& fileName); - protected: // Finalize the dependency information for the target. virtual bool Finalize(std::ostream& makeDepends, |