xref: /llvm-project/clang/test/Analysis/ctu-test-import-failure.cpp (revision 8e97f50eed71ff59b5a6fcb31e3e1af3fb30cdb4)
1 // RUN: rm -rf %t && mkdir %t
2 // RUN: mkdir -p %t/ctudir
3 // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -std=c++17 \
4 // RUN:   -emit-pch -o %t/ctudir/ctu-test-import-failure-import.cpp.ast %S/Inputs/ctu-test-import-failure-import.cpp
5 // RUN: cp %S/Inputs/ctu-test-import-failure-import.cpp.externalDefMap.ast-dump.txt %t/ctudir/externalDefMap.txt
6 // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -std=c++17 -analyze \
7 // RUN:   -analyzer-checker=core \
8 // RUN:   -analyzer-config experimental-enable-naive-ctu-analysis=true \
9 // RUN:   -analyzer-config ctu-dir=%t/ctudir \
10 // RUN:   -verify %s
11 
12 // Check that importing this code does not cause crash.
13 // Import intentionally fails because mismatch of '__get_first_arg'.
14 
15 namespace std {
16 inline namespace __cxx11 {}
17 template <typename _CharT, typename> class basic_istream;
18 struct __get_first_arg;
19 inline namespace __cxx11 {
20 template <typename, typename, typename> class basic_string;
21 }
22 template <typename _CharT, typename _Traits, typename _Alloc>
23 basic_istream<_CharT, _Traits> &getline(basic_istream<_CharT, _Traits> &,
24                                         basic_string<_CharT, _Traits, _Alloc> &,
25                                         _CharT) {}
26 } // namespace std
27 namespace CommandLine {
28 extern const int RootExamples[];
29 }
30 
31 // expected-warning@Inputs/ctu-test-import-failure-import.cpp:14{{incompatible definitions}}
32 // expected-warning@Inputs/ctu-test-import-failure-import.cpp:14{{incompatible definitions}}
33 // expected-note@Inputs/ctu-test-import-failure-import.cpp:14{{no corresponding field here}}
34 // expected-note@Inputs/ctu-test-import-failure-import.cpp:14{{no corresponding field here}}
35