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 --- /dev/null +++ b/clang/test/Analysis/Inputs/ctu-inherited-default-ctor-other.cpp @@ -0,0 +1,27 @@ +namespace llvm { +template +class impl; +// basecase +template +class impl {}; +// recursion +template +class impl : impl { + using child = impl; + using child::child; // no-crash + impl(T); +}; +template +class container : impl<0, TS...> {}; +} // namespace llvm +namespace clang { +class fun { + llvm::container 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 --- /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