Author: Balazs Benics Date: 2021-03-10T12:42:24+01:00 New Revision: 0e0ea9ffb8027b2e785b383d66b06bbd92dc7a46
URL: https://github.com/llvm/llvm-project/commit/0e0ea9ffb8027b2e785b383d66b06bbd92dc7a46 DIFF: https://github.com/llvm/llvm-project/commit/0e0ea9ffb8027b2e785b383d66b06bbd92dc7a46.diff LOG: [analyzer][CTU][NFC] Add an extra regression test Before `bc713f6a004723d1325bc16e1efc32d0ac82f939` landed, the analyzer crashed on this reduced example. It seems important to have bot `ctu` and `-analyzer-opt-analyze-headers` enabled in the example. This test file ensures that no regression happens in the future in this regard. Reviewed By: martong, NoQ Differential Revision: https://reviews.llvm.org/D96586 Added: clang/test/Analysis/Inputs/ctu-inherited-default-ctor-other.cpp clang/test/Analysis/ctu-inherited-default-ctor.cpp Modified: Removed: ################################################################################ diff --git a/clang/test/Analysis/Inputs/ctu-inherited-default-ctor-other.cpp b/clang/test/Analysis/Inputs/ctu-inherited-default-ctor-other.cpp new file mode 100644 index 000000000000..b529f416999d --- /dev/null +++ b/clang/test/Analysis/Inputs/ctu-inherited-default-ctor-other.cpp @@ -0,0 +1,27 @@ +namespace llvm { +template <int, typename...> +class impl; +// basecase +template <int n> +class impl<n> {}; +// recursion +template <int n, typename T, typename... TS> +class impl<n, T, TS...> : impl<n + 1, TS...> { + using child = impl<n + 1, TS...>; + using child::child; // no-crash + impl(T); +}; +template <typename... TS> +class container : impl<0, TS...> {}; +} // namespace llvm +namespace clang { +class fun { + llvm::container<int, float> k; + fun() {} +}; +class DeclContextLookupResult { + static int *const SingleElementDummyList; +}; +} // namespace clang +using namespace clang; +int *const DeclContextLookupResult::SingleElementDummyList = nullptr; diff --git a/clang/test/Analysis/ctu-inherited-default-ctor.cpp b/clang/test/Analysis/ctu-inherited-default-ctor.cpp new file mode 100644 index 000000000000..e3e7744e493c --- /dev/null +++ b/clang/test/Analysis/ctu-inherited-default-ctor.cpp @@ -0,0 +1,28 @@ +// Should not crash with '-analyzer-opt-analyze-headers' option during CTU analysis. +// +// RUN: rm -r %t && mkdir -p %t/ctudir +// RUN: %clang_cc1 -std=c++14 -triple x86_64-pc-linux-gnu \ +// RUN: -emit-pch -o %t/ctudir/ctu-inherited-default-ctor-other.cpp.ast \ +// RUN: %S/Inputs/ctu-inherited-default-ctor-other.cpp +// RUN: echo "c:@N@clang@S@DeclContextLookupResult@SingleElementDummyList ctu-inherited-default-ctor-other.cpp.ast" \ +// RUN: > %t/ctudir/externalDefMap.txt +// +// RUN: %clang_analyze_cc1 -std=c++14 -triple x86_64-pc-linux-gnu \ +// RUN: -analyzer-opt-analyze-headers \ +// RUN: -analyzer-checker=core \ +// RUN: -analyzer-config experimental-enable-naive-ctu-analysis=true \ +// RUN: -analyzer-config ctu-dir=%t/ctudir \ +// RUN: -analyzer-config display-ctu-progress=true \ +// RUN: -verify %s 2>&1 | FileCheck %s +// +// expected-no-diagnostics +// +// CHECK: CTU loaded AST file: ctu-inherited-default-ctor-other.cpp.ast + +namespace clang {} +namespace llvm {} +namespace clang { +class DeclContextLookupResult { + static int *const SingleElementDummyList; +}; +} // namespace clang _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits