فهرست منبع

cmMakefile: Add API for elseif to create backtrace.

Stephen Kelly 10 سال پیش
والد
کامیت
b68f2ea8ae
3فایلهای تغییر یافته به همراه17 افزوده شده و 5 حذف شده
  1. 2 5
      Source/cmIfCommand.cxx
  2. 14 0
      Source/cmMakefile.cxx
  3. 1 0
      Source/cmMakefile.h

+ 2 - 5
Source/cmIfCommand.cxx

@@ -92,10 +92,6 @@ IsFunctionBlocked(const cmListFileFunction& lff,
             }
           else
             {
-            // Place this call on the call stack.
-            cmMakefileCall stack_manager(&mf, this->Functions[c], status);
-            static_cast<void>(stack_manager);
-
             // if trace is enabled, print the evaluated "elseif" statement
             if(mf.GetCMakeInstance()->GetTrace())
               {
@@ -119,7 +115,8 @@ IsFunctionBlocked(const cmListFileFunction& lff,
               {
               std::string err = cmIfCommandError(expandedArguments);
               err += errorString;
-              mf.IssueMessage(messType, err);
+              cmListFileBacktrace bt = mf.GetBacktrace(this->Functions[c]);
+              mf.GetCMakeInstance()->IssueMessage(messType, err, bt);
               if (messType == cmake::FATAL_ERROR)
                 {
                 cmSystemTools::SetFatalErrorOccured();

+ 14 - 0
Source/cmMakefile.cxx

@@ -286,6 +286,20 @@ cmListFileBacktrace cmMakefile::GetBacktrace() const
   return backtrace;
 }
 
+//----------------------------------------------------------------------------
+cmListFileBacktrace
+cmMakefile::GetBacktrace(cmListFileContext const& lfc) const
+{
+  cmListFileBacktrace backtrace(this->GetLocalGenerator());
+  backtrace.Append(lfc);
+  for(CallStackType::const_reverse_iterator i = this->CallStack.rbegin();
+      i != this->CallStack.rend(); ++i)
+    {
+    backtrace.Append(*i->Context);
+    }
+  return backtrace;
+}
+
 //----------------------------------------------------------------------------
 cmListFileContext cmMakefile::GetExecutionContext() const
 {

+ 1 - 0
Source/cmMakefile.h

@@ -572,6 +572,7 @@ public:
    * Get the current context backtrace.
    */
   cmListFileBacktrace GetBacktrace() const;
+  cmListFileBacktrace GetBacktrace(cmListFileContext const& lfc) const;
   cmListFileContext GetExecutionContext() const;
 
   /**