[PATCH] D96586: [analyzer][CTU][NFC] Add an extra regression test
Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 10 03:36:18 PST 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0e0ea9ffb802: [analyzer][CTU][NFC] Add an extra regression test (authored by Balazs Benics <balazsbenics at sigmatechnology.se>).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D96586/new/
https://reviews.llvm.org/D96586
Files:
clang/test/Analysis/Inputs/ctu-inherited-default-ctor-other.cpp
clang/test/Analysis/ctu-inherited-default-ctor.cpp
Index: clang/test/Analysis/ctu-inherited-default-ctor.cpp
===================================================================
--- /dev/null
+++ 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 at clang@S at 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
Index: clang/test/Analysis/Inputs/ctu-inherited-default-ctor-other.cpp
===================================================================
--- /dev/null
+++ 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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96586.329599.patch
Type: text/x-patch
Size: 2256 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210310/febb767e/attachment.bin>
More information about the cfe-commits
mailing list