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.
This commit is contained in:
Brad King
2018-09-25 10:41:29 -04:00
parent 22aa6b67b4
commit 6c2af9d302
2 changed files with 2 additions and 1 deletions

View File

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

View File

@@ -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.