Bläddra i källkod

cmListFileCache: Add missing assertion in backtrace Top method

We can only get the top of a stack that has at least one call.
Update the method's comment accordingly.
Brad King 7 år sedan
förälder
incheckning
6c2af9d302
2 ändrade filer med 2 tillägg och 1 borttagningar
  1. 1 0
      Source/cmListFileCache.cxx
  2. 1 1
      Source/cmListFileCache.h

+ 1 - 0
Source/cmListFileCache.cxx

@@ -377,6 +377,7 @@ cmListFileBacktrace cmListFileBacktrace::Pop() const
 cmListFileContext const& cmListFileBacktrace::Top() const
 {
   assert(this->TopEntry);
+  assert(!this->TopEntry->IsBottom());
   return this->TopEntry->Context;
 }
 

+ 1 - 1
Source/cmListFileCache.h

@@ -144,7 +144,7 @@ public:
   cmListFileBacktrace Pop() const;
 
   // Get the context at the top of the backtrace.
-  // Returns an empty context if the backtrace is empty.
+  // This may be called only if Empty() would return false.
   cmListFileContext const& Top() const;
 
   // Print the top of the backtrace.