summaryrefslogtreecommitdiffstats
path: root/Source/cmListFileCache.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2016-01-28 21:10:28 (GMT)
committerBrad King <brad.king@kitware.com>2016-08-25 13:47:27 (GMT)
commit1462576bcba68310395a7185e4b77da38e1e6b33 (patch)
treeb2819f0255a864e547807d4b87b8d3e2d580ed5f /Source/cmListFileCache.cxx
parent421012a330989a64b24a3289379bb4938e6ed3ea (diff)
downloadCMake-1462576bcba68310395a7185e4b77da38e1e6b33.zip
CMake-1462576bcba68310395a7185e4b77da38e1e6b33.tar.gz
CMake-1462576bcba68310395a7185e4b77da38e1e6b33.tar.bz2
Parser: Port away from cmMakefile
It is an unneeded dependency.
Diffstat (limited to 'Source/cmListFileCache.cxx')
-rw-r--r--Source/cmListFileCache.cxx31
1 files changed, 16 insertions, 15 deletions
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index 9204d14..39d9e97 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -12,7 +12,7 @@
#include "cmListFileCache.h"
#include "cmListFileLexer.h"
-#include "cmMakefile.h"
+#include "cmMessenger.h"
#include "cmOutputConverter.h"
#include "cmSystemTools.h"
#include "cmVersion.h"
@@ -21,7 +21,8 @@
struct cmListFileParser
{
- cmListFileParser(cmListFile* lf, cmMakefile* mf, const char* filename);
+ cmListFileParser(cmListFile* lf, cmListFileBacktrace lfbt,
+ cmMessenger* messenger, const char* filename);
~cmListFileParser();
void IssueFileOpenError(std::string const& text) const;
void IssueError(std::string const& text) const;
@@ -30,8 +31,8 @@ struct cmListFileParser
bool AddArgument(cmListFileLexer_Token* token,
cmListFileArgument::Delimiter delim);
cmListFile* ListFile;
- cmMakefile* Makefile;
cmListFileBacktrace Backtrace;
+ cmMessenger* Messenger;
const char* FileName;
cmListFileLexer* Lexer;
cmListFileFunction Function;
@@ -43,11 +44,12 @@ struct cmListFileParser
} Separation;
};
-cmListFileParser::cmListFileParser(cmListFile* lf, cmMakefile* mf,
+cmListFileParser::cmListFileParser(cmListFile* lf, cmListFileBacktrace lfbt,
+ cmMessenger* messenger,
const char* filename)
: ListFile(lf)
- , Makefile(mf)
- , Backtrace(mf->GetBacktrace())
+ , Backtrace(lfbt)
+ , Messenger(messenger)
, FileName(filename)
, Lexer(cmListFileLexer_New())
{
@@ -60,7 +62,7 @@ cmListFileParser::~cmListFileParser()
void cmListFileParser::IssueFileOpenError(const std::string& text) const
{
- this->Makefile->IssueMessage(cmake::FATAL_ERROR, text);
+ this->Messenger->IssueMessage(cmake::FATAL_ERROR, text, this->Backtrace);
}
void cmListFileParser::IssueError(const std::string& text) const
@@ -70,8 +72,7 @@ void cmListFileParser::IssueError(const std::string& text) const
lfc.Line = cmListFileLexer_GetCurrentLine(this->Lexer);
cmListFileBacktrace lfbt = this->Backtrace;
lfbt = lfbt.Push(lfc);
- this->Makefile->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, text,
- lfbt);
+ this->Messenger->IssueMessage(cmake::FATAL_ERROR, text, lfbt);
cmSystemTools::SetFatalErrorOccured();
}
@@ -129,7 +130,8 @@ bool cmListFileParser::ParseFile()
return true;
}
-bool cmListFile::ParseFile(const char* filename, cmMakefile* mf)
+bool cmListFile::ParseFile(const char* filename, cmMessenger* messenger,
+ cmListFileBacktrace const& lfbt)
{
if (!cmSystemTools::FileExists(filename) ||
cmSystemTools::FileIsDirectory(filename)) {
@@ -139,7 +141,7 @@ bool cmListFile::ParseFile(const char* filename, cmMakefile* mf)
bool parseError = false;
{
- cmListFileParser parser(this, mf, filename);
+ cmListFileParser parser(this, lfbt, messenger, filename);
parseError = !parser.ParseFile();
}
@@ -242,8 +244,7 @@ bool cmListFileParser::ParseFunction(const char* name, long line)
lfbt = lfbt.Push(lfc);
error << "Parse error. Function missing ending \")\". "
<< "End of file reached.";
- this->Makefile->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR,
- error.str(), lfbt);
+ this->Messenger->IssueMessage(cmake::FATAL_ERROR, error.str(), lfbt);
return false;
}
@@ -269,10 +270,10 @@ bool cmListFileParser::AddArgument(cmListFileLexer_Token* token,
<< "Argument not separated from preceding token by whitespace.";
/* clang-format on */
if (isError) {
- this->Makefile->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, m.str(), lfbt);
+ this->Messenger->IssueMessage(cmake::FATAL_ERROR, m.str(), lfbt);
return false;
}
- this->Makefile->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, m.str(), lfbt);
+ this->Messenger->IssueMessage(cmake::AUTHOR_WARNING, m.str(), lfbt);
return true;
}