summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-07-04 11:12:50 (GMT)
committerBrad King <brad.king@kitware.com>2015-07-06 15:22:41 (GMT)
commit238aac23514ecdae0d4edb71033e443f30e94158 (patch)
tree5cf049d75078016e4c7504689e2623e51738d99d
parent329098a9a0e81e67bd760f53811cce582a3ebdcd (diff)
downloadCMake-238aac23514ecdae0d4edb71033e443f30e94158.zip
CMake-238aac23514ecdae0d4edb71033e443f30e94158.tar.gz
CMake-238aac23514ecdae0d4edb71033e443f30e94158.tar.bz2
cmListFile: Remove FilePath member from cmListFileContext.
There is no need to store the FilePath for every function, as it is known by other means.
-rw-r--r--Source/cmIfCommand.cxx5
-rw-r--r--Source/cmListFileCache.cxx1
-rw-r--r--Source/cmListFileCache.h19
-rw-r--r--Source/cmMacroCommand.cxx1
-rw-r--r--Source/cmMakefile.cxx35
-rw-r--r--Source/cmMakefile.h4
-rw-r--r--Source/cmVariableWatchCommand.cxx1
7 files changed, 46 insertions, 20 deletions
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index 20448c1..cdf278c 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -115,7 +115,10 @@ IsFunctionBlocked(const cmListFileFunction& lff,
{
std::string err = cmIfCommandError(expandedArguments);
err += errorString;
- cmListFileBacktrace bt = mf.GetBacktrace(this->Functions[c]);
+ cmListFileContext lfc =
+ cmListFileContext::FromCommandContext(
+ this->Functions[c], this->GetStartingContext().FilePath);
+ cmListFileBacktrace bt = mf.GetBacktrace(lfc);
mf.GetCMakeInstance()->IssueMessage(messType, err, bt);
if (messType == cmake::FATAL_ERROR)
{
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index 006ca4c..9141d88 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -251,7 +251,6 @@ bool cmListFileParser::ParseFunction(const char* name, long line)
{
// Inintialize a new function call.
this->Function = cmListFileFunction();
- this->Function.FilePath = this->FileName;
this->Function.Name = name;
this->Function.Line = line;
diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h
index f5859ec..57bf253 100644
--- a/Source/cmListFileCache.h
+++ b/Source/cmListFileCache.h
@@ -25,6 +25,13 @@
class cmMakefile;
+struct cmCommandContext
+{
+ std::string Name;
+ long Line;
+ cmCommandContext(): Name(), Line(0) {}
+};
+
struct cmListFileArgument
{
enum Delimiter
@@ -57,6 +64,16 @@ struct cmListFileContext
std::string FilePath;
long Line;
cmListFileContext(): Name(), FilePath(), Line(0) {}
+
+ static cmListFileContext FromCommandContext(cmCommandContext const& lfcc,
+ std::string const& fileName)
+ {
+ cmListFileContext lfc;
+ lfc.FilePath = fileName;
+ lfc.Line = lfcc.Line;
+ lfc.Name = lfcc.Name;
+ return lfc;
+ }
};
std::ostream& operator<<(std::ostream&, cmListFileContext const&);
@@ -64,7 +81,7 @@ bool operator<(const cmListFileContext& lhs, const cmListFileContext& rhs);
bool operator==(cmListFileContext const& lhs, cmListFileContext const& rhs);
bool operator!=(cmListFileContext const& lhs, cmListFileContext const& rhs);
-struct cmListFileFunction: public cmListFileContext
+struct cmListFileFunction: public cmCommandContext
{
std::vector<cmListFileArgument> Arguments;
};
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index 3c2117b..6d3054a 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -132,7 +132,6 @@ bool cmMacroHelperCommand::InvokeInitialPass
newLFF.Arguments.clear();
newLFF.Arguments.reserve(this->Functions[c].Arguments.size());
newLFF.Name = this->Functions[c].Name;
- newLFF.FilePath = this->Functions[c].FilePath;
newLFF.Line = this->Functions[c].Line;
// for each argument of the current function
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index a65f6ba..9f2abff 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -277,12 +277,15 @@ cmListFileBacktrace cmMakefile::GetBacktrace() const
{
cmListFileBacktrace backtrace(this->StateSnapshot);
cmState::Snapshot snp = this->StateSnapshot;
- for(std::vector<cmListFileContext const*>::const_reverse_iterator
+ for(std::vector<cmCommandContext const*>::const_reverse_iterator
i = this->ContextStack.rbegin();
- i != this->ContextStack.rend(); ++i, snp = snp.GetCallStackParent())
+ i != this->ContextStack.rend();
+ ++i, snp = snp.GetCallStackParent())
{
- cmListFileContext frame = *(*i);
- frame.FilePath = snp.GetExecutionListFile();
+ assert(snp.IsValid());
+ cmListFileContext frame =
+ cmListFileContext::FromCommandContext(*(*i),
+ snp.GetExecutionListFile());
backtrace.Append(frame);
}
return backtrace;
@@ -297,12 +300,15 @@ cmMakefile::GetBacktrace(cmListFileContext const& lfc) const
cmState::Snapshot snp = this->StateSnapshot;
assert(snp.GetExecutionListFile() == lfc.FilePath);
snp = snp.GetCallStackParent();
- for(std::vector<cmListFileContext const*>::const_reverse_iterator
+ for(std::vector<cmCommandContext const*>::const_reverse_iterator
i = this->ContextStack.rbegin();
- i != this->ContextStack.rend(); ++i, snp = snp.GetCallStackParent())
+ i != this->ContextStack.rend();
+ ++i, snp = snp.GetCallStackParent())
{
- cmListFileContext frame = *(*i);
- frame.FilePath = snp.GetExecutionListFile();
+ assert(snp.IsValid());
+ cmListFileContext frame =
+ cmListFileContext::FromCommandContext(*(*i),
+ snp.GetExecutionListFile());
backtrace.Append(frame);
}
return backtrace;
@@ -311,7 +317,9 @@ cmMakefile::GetBacktrace(cmListFileContext const& lfc) const
//----------------------------------------------------------------------------
cmListFileContext cmMakefile::GetExecutionContext() const
{
- return *this->ContextStack.back();
+ return cmListFileContext::FromCommandContext(
+ *this->ContextStack.back(),
+ this->StateSnapshot.GetExecutionListFile());
}
//----------------------------------------------------------------------------
@@ -561,7 +569,6 @@ public:
cmParseFileScope(cmMakefile* mf)
: Makefile(mf)
{
- this->Context.FilePath = this->Makefile->GetExecutionFilePath();
this->Makefile->ContextStack.push_back(&this->Context);
}
@@ -572,7 +579,7 @@ public:
private:
cmMakefile* Makefile;
- cmListFileContext Context;
+ cmCommandContext Context;
};
bool cmMakefile::ReadDependentFile(const char* filename, bool noPolicyScope)
@@ -3581,11 +3588,13 @@ cmMakefile::RemoveFunctionBlocker(cmFunctionBlocker* fb,
if(!(*pos)->ShouldRemove(lff, *this))
{
cmListFileContext const& lfc = fb->GetStartingContext();
+ cmListFileContext closingContext =
+ cmListFileContext::FromCommandContext(lff, lfc.FilePath);
std::ostringstream e;
e << "A logical block opening on the line\n"
<< " " << lfc << "\n"
<< "closes on the line\n"
- << " " << lff << "\n"
+ << " " << closingContext << "\n"
<< "with mis-matching arguments.";
this->IssueMessage(cmake::AUTHOR_WARNING, e.str());
}
@@ -5595,7 +5604,7 @@ cmMakefile::MacroPushPop::~MacroPushPop()
this->Makefile->PopMacroScope(this->ReportError);
}
-cmMakefileCall::cmMakefileCall(cmMakefile* mf, const cmListFileContext& lfc,
+cmMakefileCall::cmMakefileCall(cmMakefile* mf, const cmCommandContext& lfc,
cmExecutionStatus& status): Makefile(mf)
{
this->Makefile->ContextStack.push_back(&lfc);
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 03b9c04..d3cf02e 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -937,7 +937,7 @@ private:
// stack of list files being read
std::vector<std::string> ListFileStack;
- std::vector<cmListFileContext const*> ContextStack;
+ std::vector<cmCommandContext const*> ContextStack;
std::vector<cmExecutionStatus*> ExecutionStatusStack;
friend class cmMakefileCall;
friend class cmParseFileScope;
@@ -1055,7 +1055,7 @@ class cmMakefileCall
{
public:
cmMakefileCall(cmMakefile* mf,
- cmListFileContext const& lfc,
+ cmCommandContext const& lfc,
cmExecutionStatus& status);
~cmMakefileCall();
private:
diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx
index 6521c04..98a397c 100644
--- a/Source/cmVariableWatchCommand.cxx
+++ b/Source/cmVariableWatchCommand.cxx
@@ -63,7 +63,6 @@ static void cmVariableWatchCommandVariableAccessed(
cmListFileArgument(stack, cmListFileArgument::Quoted,
9999));
newLFF.Name = data->Command;
- newLFF.FilePath = "unknown";
newLFF.Line = 9999;
cmExecutionStatus status;
if(!makefile->ExecuteCommand(newLFF,status))