[Cmake-commits] [cmake-commits] king committed cmMakefile.cxx 1.516 1.517 cmTest.cxx 1.15 1.16 cmTest.h 1.8 1.9

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Aug 11 09:07:31 EDT 2009


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv25447/Source

Modified Files:
	cmMakefile.cxx cmTest.cxx cmTest.h 
Log Message:
Record backtrace for every add_test command

We teach cmTest to hold a backtrace for the add_test command that
created it.  This will be used later to report context for errors at
generate time.


Index: cmTest.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTest.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -C 2 -d -r1.8 -r1.9
*** cmTest.h	16 Mar 2009 14:51:20 -0000	1.8
--- cmTest.h	11 Aug 2009 13:07:28 -0000	1.9
***************
*** 21,24 ****
--- 21,25 ----
  #include "cmPropertyMap.h"
  class cmMakefile;
+ class cmListFileBacktrace;
  
  /** \class cmTest
***************
*** 32,36 ****
    /**
     */
!   cmTest();
    ~cmTest();
  
--- 33,37 ----
    /**
     */
!   cmTest(cmMakefile* mf);
    ~cmTest();
  
***************
*** 60,67 ****
    static void DefineProperties(cmake *cm);
  
!   ///! Set the cmMakefile that owns this test
!   void SetMakefile(cmMakefile *mf);
    cmMakefile *GetMakefile() { return this->Makefile;};
  
    /** Get/Set whether this is an old-style test.  */
    bool GetOldStyle() const { return this->OldStyle; }
--- 61,70 ----
    static void DefineProperties(cmake *cm);
  
!   /** Get the cmMakefile instance that owns this test.  */
    cmMakefile *GetMakefile() { return this->Makefile;};
  
+   /** Get the backtrace of the command that created this test.  */
+   cmListFileBacktrace const& GetBacktrace() const;
+ 
    /** Get/Set whether this is an old-style test.  */
    bool GetOldStyle() const { return this->OldStyle; }
***************
*** 75,81 ****
    bool OldStyle;
  
!   // The cmMakefile instance that owns this target.  This should
!   // always be set.
!   cmMakefile* Makefile;  
  };
  
--- 78,83 ----
    bool OldStyle;
  
!   cmMakefile* Makefile;
!   cmListFileBacktrace* Backtrace;
  };
  

Index: cmTest.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTest.cxx,v
retrieving revision 1.15
retrieving revision 1.16
diff -C 2 -d -r1.15 -r1.16
*** cmTest.cxx	4 Aug 2009 17:16:30 -0000	1.15
--- cmTest.cxx	11 Aug 2009 13:07:28 -0000	1.16
***************
*** 22,29 ****
  
  //----------------------------------------------------------------------------
! cmTest::cmTest() 
  {
!   this->Makefile = 0;
    this->OldStyle = true;
  }
  
--- 22,32 ----
  
  //----------------------------------------------------------------------------
! cmTest::cmTest(cmMakefile* mf)
  {
!   this->Makefile = mf;
    this->OldStyle = true;
+   this->Properties.SetCMakeInstance(mf->GetCMakeInstance());
+   this->Backtrace = new cmListFileBacktrace;
+   this->Makefile->GetBacktrace(*this->Backtrace);
  }
  
***************
*** 31,34 ****
--- 34,44 ----
  cmTest::~cmTest()
  {
+   delete this->Backtrace;
+ }
+ 
+ //----------------------------------------------------------------------------
+ cmListFileBacktrace const& cmTest::GetBacktrace() const
+ {
+   return *this->Backtrace;
  }
  
***************
*** 90,100 ****
  
  //----------------------------------------------------------------------------
- void cmTest::SetMakefile(cmMakefile* mf)
- {
-   this->Makefile = mf;
-   this->Properties.SetCMakeInstance(mf->GetCMakeInstance());
- }
- 
- //----------------------------------------------------------------------------
  void cmTest::DefineProperties(cmake *cm)
  {
--- 100,103 ----

Index: cmMakefile.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefile.cxx,v
retrieving revision 1.516
retrieving revision 1.517
diff -C 2 -d -r1.516 -r1.517
*** cmMakefile.cxx	4 Aug 2009 18:37:46 -0000	1.516
--- cmMakefile.cxx	11 Aug 2009 13:07:28 -0000	1.517
***************
*** 3315,3321 ****
      return test;
      }
!   test = new cmTest;
    test->SetName(testName);
-   test->SetMakefile(this);
    this->Tests[testName] = test;
    return test;
--- 3315,3320 ----
      return test;
      }
!   test = new cmTest(this);
    test->SetName(testName);
    this->Tests[testName] = test;
    return test;



More information about the Cmake-commits mailing list