From 6c2af9d302f1c893219f2aad014a2b183bb438a1 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 25 Sep 2018 10:41:29 -0400 Subject: 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. --- Source/cmListFileCache.cxx | 1 + Source/cmListFileCache.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) 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. -- cgit v0.12 From 3c8187f68730b180cd6fad898eb81bdeaf488bb8 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 26 Sep 2018 06:38:52 -0400 Subject: clang-tidy: restore 'misc-noexcept-move-constructor' We disabled this in commit 1fe0d72eb6 (clang-tidy: exclude 'misc-noexcept-move-constructor', 2018-09-24) due to false positives. Restore it and use a NOLINT comment to suppress them instead. --- .clang-tidy | 1 - Source/cmListFileCache.h | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index ebe3c20..8d79b0c 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -5,7 +5,6 @@ misc-*,\ -misc-incorrect-roundings,\ -misc-macro-parentheses,\ -misc-misplaced-widening-cast,\ --misc-noexcept-move-constructor,\ -misc-static-assert,\ modernize-*,\ -modernize-deprecated-headers,\ diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h index faddec7..3d3afdf 100644 --- a/Source/cmListFileCache.h +++ b/Source/cmListFileCache.h @@ -124,9 +124,11 @@ public: // Backtraces may be copied, moved, and assigned as values. cmListFileBacktrace(cmListFileBacktrace const&) = default; - cmListFileBacktrace(cmListFileBacktrace&&) noexcept = default; + cmListFileBacktrace(cmListFileBacktrace&&) // NOLINT(clang-tidy) + noexcept = default; cmListFileBacktrace& operator=(cmListFileBacktrace const&) = default; - cmListFileBacktrace& operator=(cmListFileBacktrace&&) noexcept = default; + cmListFileBacktrace& operator=(cmListFileBacktrace&&) // NOLINT(clang-tidy) + noexcept = default; ~cmListFileBacktrace() = default; cmStateSnapshot GetBottom() const; -- cgit v0.12