summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 20448c163d..cdf278c327 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 006ca4c1ff..9141d8853d 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 f5859ec63a..57bf25386b 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 3c2117b38d..6d3054a1b9 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 a65f6bac43..9f2abff2f5 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 03b9c04b51..d3cf02eed0 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 6521c04c2f..98a397cf2b 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))