cmDependsFortran: Move FindIncludeFile method into parser class
This drops the only awareness of cmDependsFortran that cmFortranParser needed.
This commit is contained in:
parent
98b9645bce
commit
295480b923
|
@ -64,13 +64,16 @@ struct cmFortranFile
|
||||||
|
|
||||||
struct cmFortranParser_s
|
struct cmFortranParser_s
|
||||||
{
|
{
|
||||||
cmFortranParser_s(cmDependsFortran* self,
|
cmFortranParser_s(std::vector<std::string> const& includes,
|
||||||
std::set<std::string>& ppDefines,
|
std::set<std::string>& ppDefines,
|
||||||
cmFortranSourceInfo& info);
|
cmFortranSourceInfo& info);
|
||||||
~cmFortranParser_s();
|
~cmFortranParser_s();
|
||||||
|
|
||||||
// Pointer back to the main class.
|
bool FindIncludeFile(const char* dir, const char* includeName,
|
||||||
cmDependsFortran* Self;
|
std::string& fileName);
|
||||||
|
|
||||||
|
// The include file search path.
|
||||||
|
std::vector<std::string> IncludePath;
|
||||||
|
|
||||||
// Lexical scanner instance.
|
// Lexical scanner instance.
|
||||||
yyscan_t Scanner;
|
yyscan_t Scanner;
|
||||||
|
@ -201,7 +204,7 @@ bool cmDependsFortran::WriteDependencies(
|
||||||
|
|
||||||
// Create the parser object. The constructor takes ppMacro and info per
|
// Create the parser object. The constructor takes ppMacro and info per
|
||||||
// reference, so we may look into the resulting objects later.
|
// 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.
|
// Push on the starting file.
|
||||||
cmFortranParser_FilePush(&parser, src.c_str());
|
cmFortranParser_FilePush(&parser, src.c_str());
|
||||||
|
@ -885,7 +888,7 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile,
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool cmDependsFortran::FindIncludeFile(const char* dir,
|
bool cmFortranParser_s::FindIncludeFile(const char* dir,
|
||||||
const char* includeName,
|
const char* includeName,
|
||||||
std::string& fileName)
|
std::string& fileName)
|
||||||
{
|
{
|
||||||
|
@ -927,10 +930,10 @@ bool cmDependsFortran::FindIncludeFile(const char* dir,
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
cmFortranParser_s
|
cmFortranParser_s
|
||||||
::cmFortranParser_s(cmDependsFortran* self,
|
::cmFortranParser_s(std::vector<std::string> const& includes,
|
||||||
std::set<std::string>& ppDefines,
|
std::set<std::string>& ppDefines,
|
||||||
cmFortranSourceInfo& info):
|
cmFortranSourceInfo& info):
|
||||||
Self(self), PPDefinitions(ppDefines), Info(info)
|
IncludePath(includes), PPDefinitions(ppDefines), Info(info)
|
||||||
{
|
{
|
||||||
this->InInterface = 0;
|
this->InInterface = 0;
|
||||||
this->InPPFalseBranch = 0;
|
this->InPPFalseBranch = 0;
|
||||||
|
@ -1100,7 +1103,7 @@ void cmFortranParser_RuleInclude(cmFortranParser* parser,
|
||||||
// problem because either the source will not compile or the user
|
// problem because either the source will not compile or the user
|
||||||
// does not care about depending on this included source.
|
// does not care about depending on this included source.
|
||||||
std::string fullName;
|
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.
|
// Found the included file. Save it in the set of included files.
|
||||||
parser->Info.Includes.insert(fullName);
|
parser->Info.Includes.insert(fullName);
|
||||||
|
|
|
@ -46,12 +46,6 @@ public:
|
||||||
static bool ModulesDiffer(const char* modFile, const char* stampFile,
|
static bool ModulesDiffer(const char* modFile, const char* stampFile,
|
||||||
const char* compilerId);
|
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:
|
protected:
|
||||||
// Finalize the dependency information for the target.
|
// Finalize the dependency information for the target.
|
||||||
virtual bool Finalize(std::ostream& makeDepends,
|
virtual bool Finalize(std::ostream& makeDepends,
|
||||||
|
|
Loading…
Reference in New Issue