[Cmake-commits] CMake branch, next, updated. v3.3.0-rc3-820-g1965936

Stephen Kelly steveire at gmail.com
Sun Jul 5 19:37:42 EDT 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  1965936bb20f40951a1ee597769e4b92e3ae7713 (commit)
       via  87c81096f92e860a6ebcaac0d29c427d9c6fd1bd (commit)
       via  25fcf27cc84dda5fb1316aa99e73ee7dc1bec355 (commit)
       via  e5e2563e92ced9bd5718645b8999596f4a841632 (commit)
       via  1ca1dd80314bc6182b3b2d01c3bf60f7b39693cf (commit)
       via  df2cb683e045c7906bcca5d0bf7614d8e1360286 (commit)
       via  30d44efaf86194271c70f90a8fafa94a7d56f92c (commit)
       via  6361f680568c81e0391fa56cf9a7f4637bd745dc (commit)
       via  94704d759cc8939f3573122d36d52c4598fd04ba (commit)
       via  a8e54460243b0650145c8684f3d8deb8a712376a (commit)
       via  dbafb01580a0d35e33e6577ad07002f4dd345236 (commit)
       via  27ff19a96a7d12f2ed6d9683ef733eff6378472a (commit)
       via  58853582be7c8a362db5d220c87025a1c19d1c8a (commit)
      from  a1c8ac3911b6af3f34a634ff9c7cb3657abdc228 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1965936bb20f40951a1ee597769e4b92e3ae7713
commit 1965936bb20f40951a1ee597769e4b92e3ae7713
Merge: a1c8ac3 87c8109
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Jul 5 19:37:41 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Sun Jul 5 19:37:41 2015 -0400

    Merge topic 'refactor-cmListFileBacktrace' into next
    
    87c81096 cmListFileBacktrace: Implement in terms of cmState::Snapshot.
    25fcf27c cmListFile: Remove FilePath member from cmListFileContext.
    e5e2563e cmMakefile: Set the FilePath on the frame from the cmState.
    1ca1dd80 cmMakefile: Create intermediate variables for snapshot frames.
    df2cb683 cmMakefile: Create a scoped context for parsing listfiles.
    30d44efa cmMakefile: Access the execution list file from the cmState.
    6361f680 cmState: Store execution context.
    94704d75 cmState: Add GetCallStackParent method.
    a8e54460 cmState: Store snapshots for more different types.
    dbafb015 cmMakefile: Split CallStack into two pieces.
    27ff19a9 cmLinkedTree: Add operator* to the iterator.
    58853582 CMake Nightly Date Stamp


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=87c81096f92e860a6ebcaac0d29c427d9c6fd1bd
commit 87c81096f92e860a6ebcaac0d29c427d9c6fd1bd
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Fri May 29 22:37:59 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon Jul 6 01:37:18 2015 +0200

    cmListFileBacktrace: Implement in terms of cmState::Snapshot.
    
    Avoid copying many strings into each backtrace object.

diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index cdf278c..20448c1 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -115,10 +115,7 @@ IsFunctionBlocked(const cmListFileFunction& lff,
               {
               std::string err = cmIfCommandError(expandedArguments);
               err += errorString;
-              cmListFileContext lfc =
-                  cmListFileContext::FromCommandContext(
-                    this->Functions[c], this->GetStartingContext().FilePath);
-              cmListFileBacktrace bt = mf.GetBacktrace(lfc);
+              cmListFileBacktrace bt = mf.GetBacktrace(this->Functions[c]);
               mf.GetCMakeInstance()->IssueMessage(messType, err, bt);
               if (messType == cmake::FATAL_ERROR)
                 {
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index 9141d88..1097dc2 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -398,40 +398,50 @@ bool cmListFileParser::AddArgument(cmListFileLexer_Token* token,
     }
 }
 
-void cmListFileBacktrace::Append(cmListFileContext const& context)
-{
-  this->push_back(context);
-}
-
 void cmListFileBacktrace::PrintTitle(std::ostream& out)
 {
-  if (this->empty())
+  if (!this->Snapshot.IsValid())
     {
     return;
     }
-
   cmOutputConverter converter(this->Snapshot);
-  cmListFileContext lfc = this->front();
+  cmListFileContext lfc =
+      cmListFileContext::FromCommandContext(
+        this->Context, this->Snapshot.GetExecutionListFile());
   lfc.FilePath = converter.Convert(lfc.FilePath, cmOutputConverter::HOME);
   out << (lfc.Line ? " at " : " in ") << lfc;
 }
 
 void cmListFileBacktrace::PrintCallStack(std::ostream& out)
 {
-  if (size() <= 1)
+  if (!this->Snapshot.IsValid())
+    {
+    return;
+    }
+  cmState::Snapshot parent = this->Snapshot.GetCallStackParent();
+  if (!parent.IsValid() || parent.GetExecutionListFile().empty())
     {
     return;
     }
 
   cmOutputConverter converter(this->Snapshot);
-  const_iterator i = this->begin() + 1;
+  std::string commandName = this->Snapshot.GetEntryPointCommand();
+  long commandLine = this->Snapshot.GetEntryPointLine();
+
   out << "Call Stack (most recent call first):\n";
-  while(i != this->end())
+  while(parent.IsValid())
     {
-    cmListFileContext lfc = *i;
-    lfc.FilePath = converter.Convert(lfc.FilePath, cmOutputConverter::HOME);
+    cmListFileContext lfc;
+    lfc.Name = commandName;
+    lfc.Line = commandLine;
+
+    lfc.FilePath = converter.Convert(parent.GetExecutionListFile(),
+                                     cmOutputConverter::HOME);
     out << "  " << lfc << "\n";
-    ++i;
+
+    commandName = parent.GetEntryPointCommand();
+    commandLine = parent.GetEntryPointLine();
+    parent = parent.GetCallStackParent();
     }
 }
 
diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h
index 57bf253..aa8a34c 100644
--- a/Source/cmListFileCache.h
+++ b/Source/cmListFileCache.h
@@ -86,19 +86,19 @@ struct cmListFileFunction: public cmCommandContext
   std::vector<cmListFileArgument> Arguments;
 };
 
-class cmListFileBacktrace: private std::vector<cmListFileContext>
+class cmListFileBacktrace
 {
   public:
-    cmListFileBacktrace(cmState::Snapshot snapshot = cmState::Snapshot())
-      : Snapshot(snapshot)
+    cmListFileBacktrace(cmState::Snapshot snapshot = cmState::Snapshot(),
+                        cmCommandContext const& cc = cmCommandContext())
+      : Context(cc), Snapshot(snapshot)
     {
     }
 
-    void Append(cmListFileContext const& context);
-
     void PrintTitle(std::ostream& out);
     void PrintCallStack(std::ostream& out);
   private:
+    cmCommandContext Context;
     cmState::Snapshot Snapshot;
 };
 
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 0204e77..355c40f 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -275,43 +275,21 @@ void cmMakefile::IssueMessage(cmake::MessageType t,
 //----------------------------------------------------------------------------
 cmListFileBacktrace cmMakefile::GetBacktrace() const
 {
-  cmListFileBacktrace backtrace(this->StateSnapshot);
-  cmState::Snapshot snp = this->StateSnapshot;
-  for(std::vector<cmCommandContext const*>::const_reverse_iterator
-      i = this->ContextStack.rbegin();
-      i != this->ContextStack.rend();
-      ++i, snp = snp.GetCallStackParent())
+  cmListFileBacktrace backtrace;
+  if (!this->ContextStack.empty())
     {
-    assert(snp.IsValid());
-    cmListFileContext frame =
-        cmListFileContext::FromCommandContext(*(*i),
-                                              snp.GetExecutionListFile());
-    backtrace.Append(frame);
+    backtrace = cmListFileBacktrace(this->StateSnapshot,
+                                    *this->ContextStack.back());
     }
   return backtrace;
 }
 
 //----------------------------------------------------------------------------
 cmListFileBacktrace
-cmMakefile::GetBacktrace(cmListFileContext const& lfc) const
+cmMakefile::GetBacktrace(cmCommandContext const& cc) const
 {
-  cmListFileBacktrace backtrace(this->StateSnapshot);
-  backtrace.Append(lfc);
   cmState::Snapshot snp = this->StateSnapshot;
-  assert(snp.GetExecutionListFile() == lfc.FilePath);
-  snp = snp.GetCallStackParent();
-  for(std::vector<cmCommandContext const*>::const_reverse_iterator
-      i = this->ContextStack.rbegin();
-      i != this->ContextStack.rend();
-      ++i, snp = snp.GetCallStackParent())
-    {
-    assert(snp.IsValid());
-    cmListFileContext frame =
-        cmListFileContext::FromCommandContext(*(*i),
-                                              snp.GetExecutionListFile());
-    backtrace.Append(frame);
-    }
-  return backtrace;
+  return cmListFileBacktrace(snp, cc);
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index d3cf02e..82a2279 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -547,7 +547,7 @@ public:
    * Get the current context backtrace.
    */
   cmListFileBacktrace GetBacktrace() const;
-  cmListFileBacktrace GetBacktrace(cmListFileContext const& lfc) const;
+  cmListFileBacktrace GetBacktrace(cmCommandContext const& lfc) const;
   cmListFileContext GetExecutionContext() const;
 
   /**

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=25fcf27cc84dda5fb1316aa99e73ee7dc1bec355
commit 25fcf27cc84dda5fb1316aa99e73ee7dc1bec355
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sat Jul 4 13:12:50 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon Jul 6 01:37:18 2015 +0200

    cmListFile: Remove FilePath member from cmListFileContext.
    
    There is no need to store the FilePath for every function, as it is
    known by other means.

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 d60ba80..0204e77 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());
 }
 
 //----------------------------------------------------------------------------
@@ -560,7 +568,6 @@ struct cmParseFileScope
   cmParseFileScope(cmMakefile* mf)
     : Makefile(mf)
   {
-    this->Context.FilePath = this->Makefile->GetExecutionFilePath();
     this->Makefile->ContextStack.push_back(&this->Context);
   }
 
@@ -571,7 +578,7 @@ struct cmParseFileScope
 
 private:
   cmMakefile* Makefile;
-  cmListFileContext Context;
+  cmCommandContext Context;
 };
 
 bool cmMakefile::ReadDependentFile(const char* filename, bool noPolicyScope)
@@ -3580,11 +3587,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());
         }
@@ -5594,7 +5603,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))

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e5e2563e92ced9bd5718645b8999596f4a841632
commit e5e2563e92ced9bd5718645b8999596f4a841632
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sat Jul 4 12:16:39 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon Jul 6 01:37:18 2015 +0200

    cmMakefile: Set the FilePath on the frame from the cmState.
    
    To verify unit tests pass and for future bisecting.

diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 5551d87..d60ba80 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -276,11 +276,13 @@ void cmMakefile::IssueMessage(cmake::MessageType t,
 cmListFileBacktrace cmMakefile::GetBacktrace() const
 {
   cmListFileBacktrace backtrace(this->StateSnapshot);
+  cmState::Snapshot snp = this->StateSnapshot;
   for(std::vector<cmListFileContext const*>::const_reverse_iterator
       i = this->ContextStack.rbegin();
-      i != this->ContextStack.rend(); ++i)
+      i != this->ContextStack.rend(); ++i, snp = snp.GetCallStackParent())
     {
     cmListFileContext frame = *(*i);
+    frame.FilePath = snp.GetExecutionListFile();
     backtrace.Append(frame);
     }
   return backtrace;
@@ -292,11 +294,15 @@ cmMakefile::GetBacktrace(cmListFileContext const& lfc) const
 {
   cmListFileBacktrace backtrace(this->StateSnapshot);
   backtrace.Append(lfc);
+  cmState::Snapshot snp = this->StateSnapshot;
+  assert(snp.GetExecutionListFile() == lfc.FilePath);
+  snp = snp.GetCallStackParent();
   for(std::vector<cmListFileContext const*>::const_reverse_iterator
       i = this->ContextStack.rbegin();
-      i != this->ContextStack.rend(); ++i)
+      i != this->ContextStack.rend(); ++i, snp = snp.GetCallStackParent())
     {
     cmListFileContext frame = *(*i);
+    frame.FilePath = snp.GetExecutionListFile();
     backtrace.Append(frame);
     }
   return backtrace;

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1ca1dd80314bc6182b3b2d01c3bf60f7b39693cf
commit 1ca1dd80314bc6182b3b2d01c3bf60f7b39693cf
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sat Jul 4 12:14:58 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon Jul 6 01:37:18 2015 +0200

    cmMakefile: Create intermediate variables for snapshot frames.

diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index da3a4f6..5551d87 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -280,7 +280,8 @@ cmListFileBacktrace cmMakefile::GetBacktrace() const
       i = this->ContextStack.rbegin();
       i != this->ContextStack.rend(); ++i)
     {
-    backtrace.Append(*(*i));
+    cmListFileContext frame = *(*i);
+    backtrace.Append(frame);
     }
   return backtrace;
 }
@@ -295,7 +296,8 @@ cmMakefile::GetBacktrace(cmListFileContext const& lfc) const
       i = this->ContextStack.rbegin();
       i != this->ContextStack.rend(); ++i)
     {
-    backtrace.Append(*(*i));
+    cmListFileContext frame = *(*i);
+    backtrace.Append(frame);
     }
   return backtrace;
 }

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=df2cb683e045c7906bcca5d0bf7614d8e1360286
commit df2cb683e045c7906bcca5d0bf7614d8e1360286
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Jul 5 19:28:45 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon Jul 6 01:37:17 2015 +0200

    cmMakefile: Create a scoped context for parsing listfiles.
    
    Update the Syntax tests to check for updated/improved backtraces.

diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 08df655..da3a4f6 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -547,6 +547,25 @@ void cmMakefile::IncludeScope::EnforceCMP0011()
     }
 }
 
+struct cmParseFileScope
+{
+  cmParseFileScope(cmMakefile* mf)
+    : Makefile(mf)
+  {
+    this->Context.FilePath = this->Makefile->GetExecutionFilePath();
+    this->Makefile->ContextStack.push_back(&this->Context);
+  }
+
+  ~cmParseFileScope()
+  {
+    this->Makefile->ContextStack.pop_back();
+  }
+
+private:
+  cmMakefile* Makefile;
+  cmListFileContext Context;
+};
+
 bool cmMakefile::ReadDependentFile(const char* filename, bool noPolicyScope)
 {
   this->AddDefinition("CMAKE_PARENT_LIST_FILE",
@@ -558,10 +577,14 @@ bool cmMakefile::ReadDependentFile(const char* filename, bool noPolicyScope)
   IncludeScope incScope(this, filenametoread, noPolicyScope);
 
   cmListFile listFile;
+  {
+  cmParseFileScope pfs(this);
   if (!listFile.ParseFile(filenametoread.c_str(), false, this))
     {
     return false;
     }
+  }
+
   this->ReadListFile(listFile, filenametoread);
   if(cmSystemTools::GetFatalErrorOccured())
     {
@@ -619,10 +642,13 @@ bool cmMakefile::ReadListFile(const char* filename)
   ListFileScope scope(this, filenametoread);
 
   cmListFile listFile;
+  {
+  cmParseFileScope pfs(this);
   if (!listFile.ParseFile(filenametoread.c_str(), false, this))
     {
     return false;
     }
+  }
 
   this->ReadListFile(listFile, filenametoread);
   if(cmSystemTools::GetFatalErrorOccured())
@@ -1738,11 +1764,14 @@ void cmMakefile::Configure()
   this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentStart.c_str());
 
   cmListFile listFile;
+  {
+  cmParseFileScope pfs(this);
   if (!listFile.ParseFile(currentStart.c_str(), this->IsRootMakefile(), this))
     {
     this->SetConfigured();
     return;
     }
+  }
   this->ReadListFile(listFile, currentStart);
   if(cmSystemTools::GetFatalErrorOccured())
     {
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 01c9e8c..03b9c04 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -940,6 +940,7 @@ private:
   std::vector<cmListFileContext const*> ContextStack;
   std::vector<cmExecutionStatus*> ExecutionStatusStack;
   friend class cmMakefileCall;
+  friend class cmParseFileScope;
 
   std::vector<cmTarget*> ImportedTargetsOwned;
   TargetMap ImportedTargets;
diff --git a/Tests/RunCMake/Syntax/BOM-UTF-16-BE-stderr.txt b/Tests/RunCMake/Syntax/BOM-UTF-16-BE-stderr.txt
index b3f1e47..606b5bb 100644
--- a/Tests/RunCMake/Syntax/BOM-UTF-16-BE-stderr.txt
+++ b/Tests/RunCMake/Syntax/BOM-UTF-16-BE-stderr.txt
@@ -1,6 +1,8 @@
-CMake Error at CMakeLists.txt:3 \(include\):
+CMake Error in BOM-UTF-16-BE.cmake:
   File
 
-    .*/Tests/RunCMake/Syntax/BOM-UTF-16-BE.cmake
+    .*Tests/RunCMake/Syntax/BOM-UTF-16-BE.cmake
 
   starts with a Byte-Order-Mark that is not UTF-8.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/BOM-UTF-16-LE-stderr.txt b/Tests/RunCMake/Syntax/BOM-UTF-16-LE-stderr.txt
index c08c902..25c14f3 100644
--- a/Tests/RunCMake/Syntax/BOM-UTF-16-LE-stderr.txt
+++ b/Tests/RunCMake/Syntax/BOM-UTF-16-LE-stderr.txt
@@ -1,6 +1,8 @@
-CMake Error at CMakeLists.txt:3 \(include\):
+CMake Error in BOM-UTF-16-LE.cmake:
   File
 
-    .*/Tests/RunCMake/Syntax/BOM-UTF-16-LE.cmake
+    .*Tests/RunCMake/Syntax/BOM-UTF-16-LE.cmake
 
   starts with a Byte-Order-Mark that is not UTF-8.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/BOM-UTF-32-BE-stderr.txt b/Tests/RunCMake/Syntax/BOM-UTF-32-BE-stderr.txt
index 5dde4e3..7244bf4 100644
--- a/Tests/RunCMake/Syntax/BOM-UTF-32-BE-stderr.txt
+++ b/Tests/RunCMake/Syntax/BOM-UTF-32-BE-stderr.txt
@@ -1,6 +1,8 @@
-CMake Error at CMakeLists.txt:3 \(include\):
+CMake Error in BOM-UTF-32-BE.cmake:
   File
 
-    .*/Tests/RunCMake/Syntax/BOM-UTF-32-BE.cmake
+    .*Tests/RunCMake/Syntax/BOM-UTF-32-BE.cmake
 
   starts with a Byte-Order-Mark that is not UTF-8.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/BOM-UTF-32-LE-stderr.txt b/Tests/RunCMake/Syntax/BOM-UTF-32-LE-stderr.txt
index eb054ec..ac59c24 100644
--- a/Tests/RunCMake/Syntax/BOM-UTF-32-LE-stderr.txt
+++ b/Tests/RunCMake/Syntax/BOM-UTF-32-LE-stderr.txt
@@ -1,6 +1,8 @@
-CMake Error at CMakeLists.txt:3 \(include\):
+CMake Error in BOM-UTF-32-LE.cmake:
   File
 
-    .*/Tests/RunCMake/Syntax/BOM-UTF-32-LE.cmake
+    .*Tests/RunCMake/Syntax/BOM-UTF-32-LE.cmake
 
   starts with a Byte-Order-Mark that is not UTF-8.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/BracketNoSpace0-stderr.txt b/Tests/RunCMake/Syntax/BracketNoSpace0-stderr.txt
index afd91f9..b9f132c 100644
--- a/Tests/RunCMake/Syntax/BracketNoSpace0-stderr.txt
+++ b/Tests/RunCMake/Syntax/BracketNoSpace0-stderr.txt
@@ -1,6 +1,8 @@
-CMake Error at CMakeLists.txt:3 \(include\):
+CMake Error in BracketNoSpace0.cmake:
   Syntax Error in cmake code at
 
-    .*/Tests/RunCMake/Syntax/BracketNoSpace0.cmake:1:27
+    .*Tests/RunCMake/Syntax/BracketNoSpace0.cmake:1:27
 
   Argument not separated from preceding token by whitespace.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/BracketNoSpace1-stderr.txt b/Tests/RunCMake/Syntax/BracketNoSpace1-stderr.txt
index 826e511..aca9c35 100644
--- a/Tests/RunCMake/Syntax/BracketNoSpace1-stderr.txt
+++ b/Tests/RunCMake/Syntax/BracketNoSpace1-stderr.txt
@@ -1,6 +1,8 @@
-CMake Error at CMakeLists.txt:3 \(include\):
+CMake Error in BracketNoSpace1.cmake:
   Syntax Error in cmake code at
 
-    .*/Tests/RunCMake/Syntax/BracketNoSpace1.cmake:1:24
+    .*Tests/RunCMake/Syntax/BracketNoSpace1.cmake:1:24
 
   Argument not separated from preceding token by whitespace.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/BracketNoSpace2-stderr.txt b/Tests/RunCMake/Syntax/BracketNoSpace2-stderr.txt
index 23ecdcd..ea37a7b 100644
--- a/Tests/RunCMake/Syntax/BracketNoSpace2-stderr.txt
+++ b/Tests/RunCMake/Syntax/BracketNoSpace2-stderr.txt
@@ -1,6 +1,8 @@
-CMake Error at CMakeLists.txt:3 \(include\):
+CMake Error in BracketNoSpace2.cmake:
   Syntax Error in cmake code at
 
-    .*/Tests/RunCMake/Syntax/BracketNoSpace2.cmake:1:44
+    .*Tests/RunCMake/Syntax/BracketNoSpace2.cmake:1:44
 
   Argument not separated from preceding token by whitespace.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/BracketNoSpace3-stderr.txt b/Tests/RunCMake/Syntax/BracketNoSpace3-stderr.txt
index 906d6fc..a4ee9d0 100644
--- a/Tests/RunCMake/Syntax/BracketNoSpace3-stderr.txt
+++ b/Tests/RunCMake/Syntax/BracketNoSpace3-stderr.txt
@@ -1,6 +1,8 @@
-CMake Error at CMakeLists.txt:3 \(include\):
+CMake Error in BracketNoSpace3.cmake:
   Syntax Error in cmake code at
 
-    .*/Tests/RunCMake/Syntax/BracketNoSpace3.cmake:1:45
+    .*Tests/RunCMake/Syntax/BracketNoSpace3.cmake:1:45
 
   Argument not separated from preceding token by whitespace.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/BracketNoSpace4-stderr.txt b/Tests/RunCMake/Syntax/BracketNoSpace4-stderr.txt
index a461e93..e36dbab 100644
--- a/Tests/RunCMake/Syntax/BracketNoSpace4-stderr.txt
+++ b/Tests/RunCMake/Syntax/BracketNoSpace4-stderr.txt
@@ -1,6 +1,8 @@
-CMake Error at CMakeLists.txt:3 \(include\):
+CMake Error in BracketNoSpace4.cmake:
   Syntax Error in cmake code at
 
-    .*/Tests/RunCMake/Syntax/BracketNoSpace4.cmake:1:44
+    .*Tests/RunCMake/Syntax/BracketNoSpace4.cmake:1:44
 
   Argument not separated from preceding token by whitespace.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/BracketNoSpace5-stderr.txt b/Tests/RunCMake/Syntax/BracketNoSpace5-stderr.txt
index ff8bf1c..0ef8b13 100644
--- a/Tests/RunCMake/Syntax/BracketNoSpace5-stderr.txt
+++ b/Tests/RunCMake/Syntax/BracketNoSpace5-stderr.txt
@@ -1,6 +1,8 @@
-CMake Error at CMakeLists.txt:3 \(include\):
+CMake Error in BracketNoSpace5.cmake:
   Syntax Error in cmake code at
 
-    .*/Tests/RunCMake/Syntax/BracketNoSpace5.cmake:1:45
+    .*Tests/RunCMake/Syntax/BracketNoSpace5.cmake:1:45
 
   Argument not separated from preceding token by whitespace.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/ParenInENV-stderr.txt b/Tests/RunCMake/Syntax/ParenInENV-stderr.txt
index 7ecfe11..d2c6b6f 100644
--- a/Tests/RunCMake/Syntax/ParenInENV-stderr.txt
+++ b/Tests/RunCMake/Syntax/ParenInENV-stderr.txt
@@ -1,15 +1,17 @@
-CMake Warning \(dev\) at CMakeLists.txt:3 \(include\):
+CMake Warning \(dev\) in ParenInENV.cmake:
   Syntax Warning in cmake code at
 
-    .*/Tests/RunCMake/Syntax/ParenInENV.cmake:2:21
+    .*Tests/RunCMake/Syntax/ParenInENV.cmake:2:21
 
   Argument not separated from preceding token by whitespace.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
 This warning is for project developers.  Use -Wno-dev to suppress it.
 
 CMake Error at ParenInENV.cmake:2 \(message\):
   Syntax error in cmake code at
 
-    .*/Tests/RunCMake/Syntax/ParenInENV.cmake:2
+    .*Tests/RunCMake/Syntax/ParenInENV.cmake:2
 
   when parsing string
 
diff --git a/Tests/RunCMake/Syntax/ParenNoSpace1-stderr.txt b/Tests/RunCMake/Syntax/ParenNoSpace1-stderr.txt
index 64ef8b1..97b1b71 100644
--- a/Tests/RunCMake/Syntax/ParenNoSpace1-stderr.txt
+++ b/Tests/RunCMake/Syntax/ParenNoSpace1-stderr.txt
@@ -1,22 +1,28 @@
-CMake Warning \(dev\) at CMakeLists.txt:3 \(include\):
+CMake Warning \(dev\) in ParenNoSpace1.cmake:
   Syntax Warning in cmake code at
 
-    .*/Tests/RunCMake/Syntax/ParenNoSpace1.cmake:1:26
+    .*Tests/RunCMake/Syntax/ParenNoSpace1.cmake:1:26
 
   Argument not separated from preceding token by whitespace.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
 This warning is for project developers.  Use -Wno-dev to suppress it.
 
-CMake Warning \(dev\) at CMakeLists.txt:3 \(include\):
+CMake Warning \(dev\) in ParenNoSpace1.cmake:
   Syntax Warning in cmake code at
 
-    .*/Tests/RunCMake/Syntax/ParenNoSpace1.cmake:2:26
+    .*Tests/RunCMake/Syntax/ParenNoSpace1.cmake:2:26
 
   Argument not separated from preceding token by whitespace.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
 This warning is for project developers.  Use -Wno-dev to suppress it.
 
-CMake Error at CMakeLists.txt:3 \(include\):
+CMake Error in ParenNoSpace1.cmake:
   Syntax Error in cmake code at
 
-    .*/Tests/RunCMake/Syntax/ParenNoSpace1.cmake:3:29
+    .*Tests/RunCMake/Syntax/ParenNoSpace1.cmake:3:29
 
   Argument not separated from preceding token by whitespace.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/Syntax/StringNoSpace-stderr.txt b/Tests/RunCMake/Syntax/StringNoSpace-stderr.txt
index 89c2d2a..d79a79b 100644
--- a/Tests/RunCMake/Syntax/StringNoSpace-stderr.txt
+++ b/Tests/RunCMake/Syntax/StringNoSpace-stderr.txt
@@ -1,17 +1,21 @@
-CMake Warning \(dev\) at CMakeLists.txt:3 \(include\):
+CMake Warning \(dev\) in StringNoSpace.cmake:
   Syntax Warning in cmake code at
 
-    .*/Tests/RunCMake/Syntax/StringNoSpace.cmake:2:28
+    .*Tests/RunCMake/Syntax/StringNoSpace.cmake:2:28
 
   Argument not separated from preceding token by whitespace.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
 This warning is for project developers.  Use -Wno-dev to suppress it.
 
-CMake Warning \(dev\) at CMakeLists.txt:3 \(include\):
+CMake Warning \(dev\) in StringNoSpace.cmake:
   Syntax Warning in cmake code at
 
-    .*/Tests/RunCMake/Syntax/StringNoSpace.cmake:2:31
+    .*Tests/RunCMake/Syntax/StringNoSpace.cmake:2:31
 
   Argument not separated from preceding token by whitespace.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
 This warning is for project developers.  Use -Wno-dev to suppress it.
 
 \[1 \${var} \\n 4\]

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=30d44efaf86194271c70f90a8fafa94a7d56f92c
commit 30d44efaf86194271c70f90a8fafa94a7d56f92c
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sat Jul 4 12:20:47 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon Jul 6 01:37:17 2015 +0200

    cmMakefile: Access the execution list file from the cmState.

diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index eb26474..08df655 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -3418,7 +3418,8 @@ std::string cmMakefile::GetExecutionFilePath() const
     {
     return std::string();
     }
-  return this->ContextStack.back()->FilePath;
+  assert(this->StateSnapshot.IsValid());
+  return this->StateSnapshot.GetExecutionListFile();
 }
 
 //----------------------------------------------------------------------------

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6361f680568c81e0391fa56cf9a7f4637bd745dc
commit 6361f680568c81e0391fa56cf9a7f4637bd745dc
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun May 31 19:37:08 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon Jul 6 01:37:15 2015 +0200

    cmState: Store execution context.
    
    Extend snapshot creation API to store the file being executed and the
    entry point to get to that context.

diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx
index b3576c3..78853ce 100644
--- a/Source/cmFunctionCommand.cxx
+++ b/Source/cmFunctionCommand.cxx
@@ -95,6 +95,7 @@ bool cmFunctionHelperCommand::InvokeInitialPass
     }
 
   cmMakefile::FunctionPushPop functionScope(this->Makefile,
+                                            this->FilePath,
                                             this->Policies);
 
   // set the value of argc
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index 0b945b2..3c2117b 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -97,6 +97,7 @@ bool cmMacroHelperCommand::InvokeInitialPass
     }
 
   cmMakefile::MacroPushPop macroScope(this->Makefile,
+                                      this->FilePath,
                                       this->Policies);
 
   // set the value of argc
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index a176cda..eb26474 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -465,8 +465,11 @@ cmMakefile::IncludeScope::IncludeScope(cmMakefile* mf,
   this->Makefile->PushFunctionBlockerBarrier();
 
   this->Makefile->StateSnapshot =
-        this->Makefile->GetState()->CreateCallStackSnapshot(
-            this->Makefile->StateSnapshot);
+      this->Makefile->GetState()->CreateCallStackSnapshot(
+        this->Makefile->StateSnapshot,
+        this->Makefile->ContextStack.back()->Name,
+        this->Makefile->ContextStack.back()->Line,
+        filenametoread);
 }
 
 //----------------------------------------------------------------------------
@@ -576,9 +579,16 @@ public:
     this->Makefile->ListFileStack.push_back(filenametoread);
     this->Makefile->PushPolicyBarrier();
 
+    long line = 0;
+    std::string name;
+    if (!this->Makefile->ContextStack.empty())
+      {
+      line = this->Makefile->ContextStack.back()->Line;
+      name = this->Makefile->ContextStack.back()->Name;
+      }
     this->Makefile->StateSnapshot =
         this->Makefile->GetState()->CreateInlineListFileSnapshot(
-          this->Makefile->StateSnapshot);
+          this->Makefile->StateSnapshot, name, line, filenametoread);
     assert(this->Makefile->StateSnapshot.IsValid());
     this->Makefile->PushFunctionBlockerBarrier();
   }
@@ -1590,11 +1600,14 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent)
   this->ImportedTargets = parent->ImportedTargets;
 }
 
-void cmMakefile::PushFunctionScope(const cmPolicies::PolicyMap& pm)
+void cmMakefile::PushFunctionScope(std::string const& fileName,
+                                   const cmPolicies::PolicyMap& pm)
 {
   this->StateSnapshot =
       this->GetState()->CreateFunctionCallSnapshot(
-        this->StateSnapshot);
+        this->StateSnapshot,
+        this->ContextStack.back()->Name, this->ContextStack.back()->Line,
+        fileName);
   assert(this->StateSnapshot.IsValid());
 
   this->Internal->PushDefinitions();
@@ -1632,11 +1645,14 @@ void cmMakefile::PopFunctionScope(bool reportError)
   this->Internal->PopDefinitions();
 }
 
-void cmMakefile::PushMacroScope(const cmPolicies::PolicyMap& pm)
+void cmMakefile::PushMacroScope(std::string const& fileName,
+                                const cmPolicies::PolicyMap& pm)
 {
   this->StateSnapshot =
       this->GetState()->CreateMacroCallSnapshot(
-        this->StateSnapshot);
+        this->StateSnapshot,
+        this->ContextStack.back()->Name, this->ContextStack.back()->Line,
+        fileName);
   assert(this->StateSnapshot.IsValid());
 
   this->PushFunctionBlockerBarrier();
@@ -1670,6 +1686,7 @@ public:
     std::string currentStart =
         this->Makefile->StateSnapshot.GetCurrentSourceDirectory();
     currentStart += "/CMakeLists.txt";
+    this->Makefile->StateSnapshot.SetListFile(currentStart);
     this->Makefile->ListFileStack.push_back(currentStart);
     this->Makefile->PushPolicyBarrier();
     this->Makefile->PushFunctionBlockerBarrier();
@@ -1813,7 +1830,9 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath,
     }
 
   cmState::Snapshot newSnapshot = this->GetState()
-      ->CreateBuildsystemDirectorySnapshot(this->StateSnapshot);
+      ->CreateBuildsystemDirectorySnapshot(this->StateSnapshot,
+                                           this->ContextStack.back()->Name,
+                                           this->ContextStack.back()->Line);
 
   // create a new local generator and set its parent
   cmLocalGenerator *lg2 = this->GetGlobalGenerator()
@@ -5511,10 +5530,11 @@ AddRequiredTargetCFeature(cmTarget *target, const std::string& feature) const
 
 
 cmMakefile::FunctionPushPop::FunctionPushPop(cmMakefile* mf,
+                                             const std::string& fileName,
                                              cmPolicies::PolicyMap const& pm)
   : Makefile(mf), ReportError(true)
 {
-  this->Makefile->PushFunctionScope(pm);
+  this->Makefile->PushFunctionScope(fileName, pm);
 }
 
 cmMakefile::FunctionPushPop::~FunctionPushPop()
@@ -5524,10 +5544,11 @@ cmMakefile::FunctionPushPop::~FunctionPushPop()
 
 
 cmMakefile::MacroPushPop::MacroPushPop(cmMakefile* mf,
+                                       const std::string& fileName,
                                        const cmPolicies::PolicyMap& pm)
   : Makefile(mf), ReportError(true)
 {
-  this->Makefile->PushMacroScope(pm);
+  this->Makefile->PushMacroScope(fileName, pm);
 }
 
 cmMakefile::MacroPushPop::~MacroPushPop()
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 0ade8e1..01c9e8c 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -720,7 +720,7 @@ public:
   class FunctionPushPop
   {
   public:
-    FunctionPushPop(cmMakefile* mf,
+    FunctionPushPop(cmMakefile* mf, std::string const& fileName,
                     cmPolicies::PolicyMap const& pm);
     ~FunctionPushPop();
 
@@ -733,8 +733,8 @@ public:
   class MacroPushPop
   {
   public:
-    MacroPushPop(cmMakefile* mf,
-                    cmPolicies::PolicyMap const& pm);
+    MacroPushPop(cmMakefile* mf, std::string const& fileName,
+                 cmPolicies::PolicyMap const& pm);
     ~MacroPushPop();
 
     void Quiet() { this->ReportError = false; }
@@ -743,9 +743,11 @@ public:
     bool ReportError;
   };
 
-  void PushFunctionScope(cmPolicies::PolicyMap const& pm);
+  void PushFunctionScope(std::string const& fileName,
+                         cmPolicies::PolicyMap const& pm);
   void PopFunctionScope(bool reportError);
-  void PushMacroScope(cmPolicies::PolicyMap const& pm);
+  void PushMacroScope(std::string const& fileName,
+                      cmPolicies::PolicyMap const& pm);
   void PopMacroScope(bool reportError);
   void PushScope();
   void PopScope();
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 5ca1cce..d918f65 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -23,8 +23,11 @@ struct cmState::SnapshotDataType
   cmState::PositionType CallStackParent;
   cmState::PositionType DirectoryParent;
   cmState::SnapshotType SnapshotType;
+  cmLinkedTree<std::string>::iterator ExecutionListFile;
   cmLinkedTree<cmState::BuildsystemDirectoryStateType>::iterator
                                                           BuildSystemDirectory;
+  std::string EntryPointCommand;
+  long EntryPointLine;
 };
 
 struct cmState::BuildsystemDirectoryStateType
@@ -227,6 +230,7 @@ cmState::Snapshot cmState::Reset()
 
   this->BuildsystemDirectory.Truncate();
   PositionType pos = this->SnapshotData.Truncate();
+  this->ExecutionListFiles.Truncate();
 
   this->DefineProperty
     ("RULE_LAUNCH_COMPILE", cmProperty::DIRECTORY,
@@ -683,61 +687,98 @@ cmState::Snapshot cmState::CreateBaseSnapshot()
   pos->SnapshotType = BuildsystemDirectoryType;
   pos->BuildSystemDirectory =
       this->BuildsystemDirectory.Extend(this->BuildsystemDirectory.Root());
+  pos->ExecutionListFile =
+      this->ExecutionListFiles.Extend(this->ExecutionListFiles.Root());
   return cmState::Snapshot(this, pos);
 }
 
 cmState::Snapshot
-cmState::CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot)
+cmState::CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot,
+                                    std::string const& entryPointCommand,
+                                    long entryPointLine)
 {
   assert(originSnapshot.IsValid());
   PositionType pos = this->SnapshotData.Extend(originSnapshot.Position);
   pos->CallStackParent = originSnapshot.Position;
+  pos->EntryPointLine = entryPointLine;
+  pos->EntryPointCommand = entryPointCommand;
   pos->DirectoryParent = originSnapshot.Position;
   pos->SnapshotType = BuildsystemDirectoryType;
   pos->BuildSystemDirectory =
       this->BuildsystemDirectory.Extend(
         originSnapshot.Position->BuildSystemDirectory);
+  pos->ExecutionListFile =
+      this->ExecutionListFiles.Extend(
+        originSnapshot.Position->ExecutionListFile);
   return cmState::Snapshot(this, pos);
 }
 
 cmState::Snapshot
-cmState::CreateFunctionCallSnapshot(cmState::Snapshot originSnapshot)
+cmState::CreateFunctionCallSnapshot(cmState::Snapshot originSnapshot,
+                                    std::string const& entryPointCommand,
+                                    long entryPointLine,
+                                    std::string const& fileName)
 {
   PositionType pos = this->SnapshotData.Extend(originSnapshot.Position,
                                                *originSnapshot.Position);
   pos->CallStackParent = originSnapshot.Position;
+  pos->EntryPointLine = entryPointLine;
+  pos->EntryPointCommand = entryPointCommand;
   pos->SnapshotType = FunctionCallType;
+  pos->ExecutionListFile = this->ExecutionListFiles.Extend(
+        originSnapshot.Position->ExecutionListFile, fileName);
   return cmState::Snapshot(this, pos);
 }
 
 
 cmState::Snapshot
-cmState::CreateMacroCallSnapshot(cmState::Snapshot originSnapshot)
+cmState::CreateMacroCallSnapshot(cmState::Snapshot originSnapshot,
+                                    std::string const& entryPointCommand,
+                                    long entryPointLine,
+                                    std::string const& fileName)
 {
   PositionType pos = this->SnapshotData.Extend(originSnapshot.Position,
                                                *originSnapshot.Position);
   pos->CallStackParent = originSnapshot.Position;
+  pos->EntryPointLine = entryPointLine;
+  pos->EntryPointCommand = entryPointCommand;
   pos->SnapshotType = MacroCallType;
+  pos->ExecutionListFile = this->ExecutionListFiles.Extend(
+        originSnapshot.Position->ExecutionListFile, fileName);
   return cmState::Snapshot(this, pos);
 }
 
 cmState::Snapshot
-cmState::CreateCallStackSnapshot(cmState::Snapshot originSnapshot)
+cmState::CreateCallStackSnapshot(cmState::Snapshot originSnapshot,
+                                 const std::string& entryPointCommand,
+                                 long entryPointLine,
+                                 const std::string& fileName)
 {
   PositionType pos = this->SnapshotData.Extend(originSnapshot.Position,
                                                *originSnapshot.Position);
   pos->CallStackParent = originSnapshot.Position;
+  pos->EntryPointLine = entryPointLine;
+  pos->EntryPointCommand = entryPointCommand;
   pos->SnapshotType = CallStackType;
+  pos->ExecutionListFile = this->ExecutionListFiles.Extend(
+        originSnapshot.Position->ExecutionListFile, fileName);
   return cmState::Snapshot(this, pos);
 }
 
 cmState::Snapshot
-cmState::CreateInlineListFileSnapshot(cmState::Snapshot originSnapshot)
+cmState::CreateInlineListFileSnapshot(cmState::Snapshot originSnapshot,
+                                      const std::string& entryPointCommand,
+                                      long entryPointLine,
+                                      const std::string& fileName)
 {
   PositionType pos = this->SnapshotData.Extend(originSnapshot.Position,
                                                *originSnapshot.Position);
   pos->CallStackParent = originSnapshot.Position;
+  pos->EntryPointLine = entryPointLine;
+  pos->EntryPointCommand = entryPointCommand;
   pos->SnapshotType = InlineListFileType;
+  pos->ExecutionListFile = this->ExecutionListFiles.Extend(
+        originSnapshot.Position->ExecutionListFile, fileName);
   return cmState::Snapshot(this, pos);
 }
 
@@ -797,6 +838,11 @@ void cmState::Snapshot::SetCurrentBinaryDirectory(std::string const& dir)
   this->ComputeRelativePathTopBinary();
 }
 
+void cmState::Snapshot::SetListFile(const std::string& listfile)
+{
+  *this->Position->ExecutionListFile = listfile;
+}
+
 std::vector<std::string> const&
 cmState::Snapshot::GetCurrentSourceDirectoryComponents() const
 {
@@ -831,6 +877,21 @@ void cmState::Snapshot::SetRelativePathTopBinary(const char* dir)
   this->Position->BuildSystemDirectory->RelativePathTopBinary = dir;
 }
 
+std::string cmState::Snapshot::GetExecutionListFile() const
+{
+  return *this->Position->ExecutionListFile;
+}
+
+std::string cmState::Snapshot::GetEntryPointCommand() const
+{
+  return this->Position->EntryPointCommand;
+}
+
+long cmState::Snapshot::GetEntryPointLine() const
+{
+  return this->Position->EntryPointLine;
+}
+
 bool cmState::Snapshot::IsValid() const
 {
   return this->State && this->Position.IsValid()
diff --git a/Source/cmState.h b/Source/cmState.h
index e35b843..473a194 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -47,6 +47,8 @@ public:
     const char* GetCurrentBinaryDirectory() const;
     void SetCurrentBinaryDirectory(std::string const& dir);
 
+    void SetListFile(std::string const& listfile);
+
     std::vector<std::string> const&
     GetCurrentSourceDirectoryComponents() const;
     std::vector<std::string> const&
@@ -57,6 +59,10 @@ public:
     void SetRelativePathTopSource(const char* dir);
     void SetRelativePathTopBinary(const char* dir);
 
+    std::string GetExecutionListFile() const;
+    std::string GetEntryPointCommand() const;
+    long GetEntryPointLine() const;
+
     bool IsValid() const;
     Snapshot GetBuildsystemDirectoryParent() const;
     Snapshot GetCallStackParent() const;
@@ -75,11 +81,25 @@ public:
 
   Snapshot CreateBaseSnapshot();
   Snapshot
-  CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot);
-  Snapshot CreateFunctionCallSnapshot(Snapshot originSnapshot);
-  Snapshot CreateMacroCallSnapshot(Snapshot originSnapshot);
-  Snapshot CreateCallStackSnapshot(Snapshot originSnapshot);
-  Snapshot CreateInlineListFileSnapshot(Snapshot originSnapshot);
+  CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot,
+                                     std::string const& entryPointCommand,
+                                     long entryPointLine);
+  Snapshot CreateFunctionCallSnapshot(Snapshot originSnapshot,
+                                      std::string const& entryPointCommand,
+                                      long entryPointLine,
+                                      std::string const& fileName);
+  Snapshot CreateMacroCallSnapshot(Snapshot originSnapshot,
+                                   std::string const& entryPointCommand,
+                                   long entryPointLine,
+                                   std::string const& fileName);
+  Snapshot CreateCallStackSnapshot(Snapshot originSnapshot,
+                                   std::string const& entryPointCommand,
+                                   long entryPointLine,
+                                   std::string const& fileName);
+  Snapshot CreateInlineListFileSnapshot(Snapshot originSnapshot,
+                                        const std::string& entryPointCommand,
+                                        long entryPointLine,
+                                        std::string const& fileName);
   Snapshot Pop(Snapshot originSnapshot);
 
   enum CacheEntryType{ BOOL=0, PATH, FILEPATH, STRING, INTERNAL,STATIC,
@@ -186,6 +206,8 @@ private:
   struct BuildsystemDirectoryStateType;
   cmLinkedTree<BuildsystemDirectoryStateType> BuildsystemDirectory;
 
+  cmLinkedTree<std::string> ExecutionListFiles;
+
   cmLinkedTree<SnapshotDataType> SnapshotData;
 
   std::vector<std::string> SourceDirectoryComponents;

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=94704d759cc8939f3573122d36d52c4598fd04ba
commit 94704d759cc8939f3573122d36d52c4598fd04ba
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sat Jul 4 06:56:13 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Sun Jul 5 16:56:36 2015 +0200

    cmState: Add GetCallStackParent method.

diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index ef55e09..5ca1cce 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -854,6 +854,28 @@ cmState::Snapshot cmState::Snapshot::GetBuildsystemDirectoryParent() const
   return snapshot;
 }
 
+cmState::Snapshot cmState::Snapshot::GetCallStackParent() const
+{
+  assert(this->State);
+  assert(this->Position != this->State->SnapshotData.Root());
+
+  Snapshot snapshot;
+  if (this->Position->SnapshotType == cmState::BuildsystemDirectoryType)
+    {
+    return snapshot;
+    }
+
+  PositionType parentPos = this->Position;
+  ++parentPos;
+  if (parentPos == this->State->SnapshotData.Root())
+    {
+    return snapshot;
+    }
+
+  snapshot = Snapshot(this->State, parentPos);
+  return snapshot;
+}
+
 cmState* cmState::Snapshot::GetState() const
 {
   return this->State;
diff --git a/Source/cmState.h b/Source/cmState.h
index 9a1f764..e35b843 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -59,6 +59,7 @@ public:
 
     bool IsValid() const;
     Snapshot GetBuildsystemDirectoryParent() const;
+    Snapshot GetCallStackParent() const;
 
     cmState* GetState() const;
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a8e54460243b0650145c8684f3d8deb8a712376a
commit a8e54460243b0650145c8684f3d8deb8a712376a
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Jun 21 21:26:36 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jul 4 11:51:27 2015 +0200

    cmState: Store snapshots for more different types.
    
    Adjust cmMakefile implementation to create the snapshots.

diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 678c1b3..a176cda 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -463,11 +463,19 @@ cmMakefile::IncludeScope::IncludeScope(cmMakefile* mf,
   this->Makefile->PushPolicyBarrier();
   this->Makefile->ListFileStack.push_back(filenametoread);
   this->Makefile->PushFunctionBlockerBarrier();
+
+  this->Makefile->StateSnapshot =
+        this->Makefile->GetState()->CreateCallStackSnapshot(
+            this->Makefile->StateSnapshot);
 }
 
 //----------------------------------------------------------------------------
 cmMakefile::IncludeScope::~IncludeScope()
 {
+  this->Makefile->StateSnapshot =
+      this->Makefile->GetState()->Pop(this->Makefile->StateSnapshot);
+  assert(this->Makefile->StateSnapshot.IsValid());
+
   this->Makefile->PopFunctionBlockerBarrier(this->ReportError);
   // Enforce matching policy scopes inside the included file.
   this->Makefile->PopPolicyBarrier(this->ReportError);
@@ -567,11 +575,20 @@ public:
   {
     this->Makefile->ListFileStack.push_back(filenametoread);
     this->Makefile->PushPolicyBarrier();
+
+    this->Makefile->StateSnapshot =
+        this->Makefile->GetState()->CreateInlineListFileSnapshot(
+          this->Makefile->StateSnapshot);
+    assert(this->Makefile->StateSnapshot.IsValid());
     this->Makefile->PushFunctionBlockerBarrier();
   }
 
   ~ListFileScope()
   {
+    this->Makefile->StateSnapshot =
+        this->Makefile->GetState()->Pop(this->Makefile->StateSnapshot);
+    assert(this->Makefile->StateSnapshot.IsValid());
+
     this->Makefile->PopFunctionBlockerBarrier(this->ReportError);
     this->Makefile->PopPolicyBarrier(this->ReportError);
     this->Makefile->ListFileStack.pop_back();
@@ -1575,6 +1592,11 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent)
 
 void cmMakefile::PushFunctionScope(const cmPolicies::PolicyMap& pm)
 {
+  this->StateSnapshot =
+      this->GetState()->CreateFunctionCallSnapshot(
+        this->StateSnapshot);
+  assert(this->StateSnapshot.IsValid());
+
   this->Internal->PushDefinitions();
 
   this->PushLoopBlockBarrier();
@@ -1594,6 +1616,9 @@ void cmMakefile::PopFunctionScope(bool reportError)
   this->PopPolicyBarrier(reportError);
   this->PopPolicy();
 
+  this->StateSnapshot = this->GetState()->Pop(this->StateSnapshot);
+  assert(this->StateSnapshot.IsValid());
+
   this->PopFunctionBlockerBarrier(reportError);
 
 #if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -1609,6 +1634,11 @@ void cmMakefile::PopFunctionScope(bool reportError)
 
 void cmMakefile::PushMacroScope(const cmPolicies::PolicyMap& pm)
 {
+  this->StateSnapshot =
+      this->GetState()->CreateMacroCallSnapshot(
+        this->StateSnapshot);
+  assert(this->StateSnapshot.IsValid());
+
   this->PushFunctionBlockerBarrier();
 
   this->PushPolicy(true, pm);
@@ -1620,6 +1650,9 @@ void cmMakefile::PopMacroScope(bool reportError)
   this->PopPolicyBarrier(reportError);
   this->PopPolicy();
 
+  this->StateSnapshot = this->GetState()->Pop(this->StateSnapshot);
+  assert(this->StateSnapshot.IsValid());
+
   this->PopFunctionBlockerBarrier(reportError);
 }
 
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 58500cc..ef55e09 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -20,6 +20,7 @@
 
 struct cmState::SnapshotDataType
 {
+  cmState::PositionType CallStackParent;
   cmState::PositionType DirectoryParent;
   cmState::SnapshotType SnapshotType;
   cmLinkedTree<cmState::BuildsystemDirectoryStateType>::iterator
@@ -690,6 +691,7 @@ cmState::CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot)
 {
   assert(originSnapshot.IsValid());
   PositionType pos = this->SnapshotData.Extend(originSnapshot.Position);
+  pos->CallStackParent = originSnapshot.Position;
   pos->DirectoryParent = originSnapshot.Position;
   pos->SnapshotType = BuildsystemDirectoryType;
   pos->BuildSystemDirectory =
@@ -698,6 +700,59 @@ cmState::CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot)
   return cmState::Snapshot(this, pos);
 }
 
+cmState::Snapshot
+cmState::CreateFunctionCallSnapshot(cmState::Snapshot originSnapshot)
+{
+  PositionType pos = this->SnapshotData.Extend(originSnapshot.Position,
+                                               *originSnapshot.Position);
+  pos->CallStackParent = originSnapshot.Position;
+  pos->SnapshotType = FunctionCallType;
+  return cmState::Snapshot(this, pos);
+}
+
+
+cmState::Snapshot
+cmState::CreateMacroCallSnapshot(cmState::Snapshot originSnapshot)
+{
+  PositionType pos = this->SnapshotData.Extend(originSnapshot.Position,
+                                               *originSnapshot.Position);
+  pos->CallStackParent = originSnapshot.Position;
+  pos->SnapshotType = MacroCallType;
+  return cmState::Snapshot(this, pos);
+}
+
+cmState::Snapshot
+cmState::CreateCallStackSnapshot(cmState::Snapshot originSnapshot)
+{
+  PositionType pos = this->SnapshotData.Extend(originSnapshot.Position,
+                                               *originSnapshot.Position);
+  pos->CallStackParent = originSnapshot.Position;
+  pos->SnapshotType = CallStackType;
+  return cmState::Snapshot(this, pos);
+}
+
+cmState::Snapshot
+cmState::CreateInlineListFileSnapshot(cmState::Snapshot originSnapshot)
+{
+  PositionType pos = this->SnapshotData.Extend(originSnapshot.Position,
+                                               *originSnapshot.Position);
+  pos->CallStackParent = originSnapshot.Position;
+  pos->SnapshotType = InlineListFileType;
+  return cmState::Snapshot(this, pos);
+}
+
+cmState::Snapshot cmState::Pop(cmState::Snapshot originSnapshot)
+{
+  PositionType pos = originSnapshot.Position;
+  PositionType prevPos = pos;
+  ++prevPos;
+  if (prevPos == this->SnapshotData.Root())
+    {
+    return Snapshot(this, prevPos);
+    }
+  return Snapshot(this, originSnapshot.Position->CallStackParent);
+}
+
 cmState::Snapshot::Snapshot(cmState* state, PositionType position)
   : State(state),
   Position(position)
diff --git a/Source/cmState.h b/Source/cmState.h
index 9c7574f..9a1f764 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -31,7 +31,11 @@ public:
 
   enum SnapshotType
   {
-    BuildsystemDirectoryType
+    BuildsystemDirectoryType,
+    FunctionCallType,
+    MacroCallType,
+    CallStackType,
+    InlineListFileType
   };
 
   class Snapshot {
@@ -69,7 +73,13 @@ public:
   };
 
   Snapshot CreateBaseSnapshot();
-  Snapshot CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot);
+  Snapshot
+  CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot);
+  Snapshot CreateFunctionCallSnapshot(Snapshot originSnapshot);
+  Snapshot CreateMacroCallSnapshot(Snapshot originSnapshot);
+  Snapshot CreateCallStackSnapshot(Snapshot originSnapshot);
+  Snapshot CreateInlineListFileSnapshot(Snapshot originSnapshot);
+  Snapshot Pop(Snapshot originSnapshot);
 
   enum CacheEntryType{ BOOL=0, PATH, FILEPATH, STRING, INTERNAL,STATIC,
                        UNINITIALIZED };

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dbafb01580a0d35e33e6577ad07002f4dd345236
commit dbafb01580a0d35e33e6577ad07002f4dd345236
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun May 31 19:37:08 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jul 4 11:51:27 2015 +0200

    cmMakefile: Split CallStack into two pieces.

diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index cdcf88c..678c1b3 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -247,11 +247,11 @@ void cmMakefile::IssueMessage(cmake::MessageType t,
                               std::string const& text) const
 {
   // Collect context information.
-  if(!this->CallStack.empty())
+  if(!this->ExecutionStatusStack.empty())
     {
     if((t == cmake::FATAL_ERROR) || (t == cmake::INTERNAL_ERROR))
       {
-      this->CallStack.back().Status->SetNestedError(true);
+      this->ExecutionStatusStack.back()->SetNestedError(true);
       }
     this->GetCMakeInstance()->IssueMessage(t, text, this->GetBacktrace());
     }
@@ -276,10 +276,11 @@ void cmMakefile::IssueMessage(cmake::MessageType t,
 cmListFileBacktrace cmMakefile::GetBacktrace() const
 {
   cmListFileBacktrace backtrace(this->StateSnapshot);
-  for(CallStackType::const_reverse_iterator i = this->CallStack.rbegin();
-      i != this->CallStack.rend(); ++i)
+  for(std::vector<cmListFileContext const*>::const_reverse_iterator
+      i = this->ContextStack.rbegin();
+      i != this->ContextStack.rend(); ++i)
     {
-    backtrace.Append(*i->Context);
+    backtrace.Append(*(*i));
     }
   return backtrace;
 }
@@ -290,10 +291,11 @@ cmMakefile::GetBacktrace(cmListFileContext const& lfc) const
 {
   cmListFileBacktrace backtrace(this->StateSnapshot);
   backtrace.Append(lfc);
-  for(CallStackType::const_reverse_iterator i = this->CallStack.rbegin();
-      i != this->CallStack.rend(); ++i)
+  for(std::vector<cmListFileContext const*>::const_reverse_iterator
+      i = this->ContextStack.rbegin();
+      i != this->ContextStack.rend(); ++i)
     {
-    backtrace.Append(*i->Context);
+    backtrace.Append(*(*i));
     }
   return backtrace;
 }
@@ -301,7 +303,7 @@ cmMakefile::GetBacktrace(cmListFileContext const& lfc) const
 //----------------------------------------------------------------------------
 cmListFileContext cmMakefile::GetExecutionContext() const
 {
-  return *this->CallStack.back().Context;
+  return *this->ContextStack.back();
 }
 
 //----------------------------------------------------------------------------
@@ -1996,7 +1998,7 @@ void cmMakefile::LogUnused(const char* reason,
     {
     std::string path;
     cmListFileContext lfc;
-    if (!this->CallStack.empty())
+    if (!this->ExecutionStatusStack.empty())
       {
       lfc = this->GetExecutionContext();
       path = lfc.FilePath;
@@ -3360,11 +3362,11 @@ bool cmMakefile::IsLoopBlock() const
 
 std::string cmMakefile::GetExecutionFilePath() const
 {
-  if (this->CallStack.empty())
+  if (this->ContextStack.empty())
     {
     return std::string();
     }
-  return this->CallStack.back().Context->FilePath;
+  return this->ContextStack.back()->FilePath;
 }
 
 //----------------------------------------------------------------------------
@@ -3455,7 +3457,7 @@ bool cmMakefile::ExpandArguments(
 //----------------------------------------------------------------------------
 void cmMakefile::AddFunctionBlocker(cmFunctionBlocker* fb)
 {
-  if(!this->CallStack.empty())
+  if(!this->ExecutionStatusStack.empty())
     {
     // Record the context in which the blocker is created.
     fb->SetStartingContext(this->GetExecutionContext());
@@ -5503,11 +5505,12 @@ cmMakefile::MacroPushPop::~MacroPushPop()
 cmMakefileCall::cmMakefileCall(cmMakefile* mf, const cmListFileContext& lfc,
                                cmExecutionStatus& status): Makefile(mf)
 {
-  cmMakefile::CallStackEntry entry = {&lfc, &status};
-  this->Makefile->CallStack.push_back(entry);
+  this->Makefile->ContextStack.push_back(&lfc);
+  this->Makefile->ExecutionStatusStack.push_back(&status);
 }
 
 cmMakefileCall::~cmMakefileCall()
 {
-  this->Makefile->CallStack.pop_back();
+  this->Makefile->ExecutionStatusStack.pop_back();
+  this->Makefile->ContextStack.pop_back();
 }
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index aa70c72..0ade8e1 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -935,14 +935,8 @@ private:
   // stack of list files being read
   std::vector<std::string> ListFileStack;
 
-  // stack of commands being invoked.
-  struct CallStackEntry
-  {
-    cmListFileContext const* Context;
-    cmExecutionStatus* Status;
-  };
-  typedef std::vector<CallStackEntry> CallStackType;
-  CallStackType CallStack;
+  std::vector<cmListFileContext const*> ContextStack;
+  std::vector<cmExecutionStatus*> ExecutionStatusStack;
   friend class cmMakefileCall;
 
   std::vector<cmTarget*> ImportedTargetsOwned;

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=27ff19a96a7d12f2ed6d9683ef733eff6378472a
commit 27ff19a96a7d12f2ed6d9683ef733eff6378472a
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Jun 8 20:09:55 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Jul 4 11:51:27 2015 +0200

    cmLinkedTree: Add operator* to the iterator.

diff --git a/Source/cmLinkedTree.h b/Source/cmLinkedTree.h
index d2339c4..df00b30 100644
--- a/Source/cmLinkedTree.h
+++ b/Source/cmLinkedTree.h
@@ -87,6 +87,24 @@ public:
       return this->Tree->GetPointer(this->Position - 1);
     }
 
+    ReferenceType operator*() const
+    {
+      assert(this->Tree);
+      assert(this->Tree->UpPositions.size() == this->Tree->Data.size());
+      assert(this->Position <= this->Tree->Data.size());
+      assert(this->Position > 0);
+      return this->Tree->GetReference(this->Position - 1);
+    }
+
+    ReferenceType operator*()
+    {
+      assert(this->Tree);
+      assert(this->Tree->UpPositions.size() == this->Tree->Data.size());
+      assert(this->Position <= this->Tree->Data.size());
+      assert(this->Position > 0);
+      return this->Tree->GetReference(this->Position - 1);
+    }
+
     bool operator==(iterator other) const
     {
       assert(this->Tree);

-----------------------------------------------------------------------

Summary of changes:
 Source/CMakeVersion.cmake                        |    2 +-
 Source/cmFunctionCommand.cxx                     |    1 +
 Source/cmLinkedTree.h                            |   18 +++
 Source/cmListFileCache.cxx                       |   39 +++---
 Source/cmListFileCache.h                         |   29 ++++-
 Source/cmMacroCommand.cxx                        |    2 +-
 Source/cmMakefile.cxx                            |  142 +++++++++++++++++-----
 Source/cmMakefile.h                              |   27 ++--
 Source/cmState.cxx                               |  140 ++++++++++++++++++++-
 Source/cmState.h                                 |   37 +++++-
 Source/cmVariableWatchCommand.cxx                |    1 -
 Tests/RunCMake/Syntax/BOM-UTF-16-BE-stderr.txt   |    6 +-
 Tests/RunCMake/Syntax/BOM-UTF-16-LE-stderr.txt   |    6 +-
 Tests/RunCMake/Syntax/BOM-UTF-32-BE-stderr.txt   |    6 +-
 Tests/RunCMake/Syntax/BOM-UTF-32-LE-stderr.txt   |    6 +-
 Tests/RunCMake/Syntax/BracketNoSpace0-stderr.txt |    6 +-
 Tests/RunCMake/Syntax/BracketNoSpace1-stderr.txt |    6 +-
 Tests/RunCMake/Syntax/BracketNoSpace2-stderr.txt |    6 +-
 Tests/RunCMake/Syntax/BracketNoSpace3-stderr.txt |    6 +-
 Tests/RunCMake/Syntax/BracketNoSpace4-stderr.txt |    6 +-
 Tests/RunCMake/Syntax/BracketNoSpace5-stderr.txt |    6 +-
 Tests/RunCMake/Syntax/ParenInENV-stderr.txt      |    8 +-
 Tests/RunCMake/Syntax/ParenNoSpace1-stderr.txt   |   18 ++-
 Tests/RunCMake/Syntax/StringNoSpace-stderr.txt   |   12 +-
 24 files changed, 431 insertions(+), 105 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list