diff options
author | Brad King <brad.king@kitware.com> | 2018-09-25 14:41:29 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-09-26 10:32:21 (GMT) |
commit | 6c2af9d302f1c893219f2aad014a2b183bb438a1 (patch) | |
tree | d149591d480e74ed76e22588b11bf92009842fcb | |
parent | 22aa6b67b41808bb9c27aeb0f8f662cd81466843 (diff) | |
download | CMake-6c2af9d302f1c893219f2aad014a2b183bb438a1.zip CMake-6c2af9d302f1c893219f2aad014a2b183bb438a1.tar.gz CMake-6c2af9d302f1c893219f2aad014a2b183bb438a1.tar.bz2 |
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.
-rw-r--r-- | Source/cmListFileCache.cxx | 1 | ||||
-rw-r--r-- | Source/cmListFileCache.h | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index e465e1a..4d7e1e2 100644 --- a/Source/cmListFileCache.cxx +++ b/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; } diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h index 2c91f7a..faddec7 100644 --- a/Source/cmListFileCache.h +++ b/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. |