1 // RUN: %clang_analyze_cc1 -std=c++14 -triple x86_64-pc-linux-gnu \
2 // RUN: -analyzer-checker=core,debug.ExprInspection \
3 // RUN: -analyzer-config eagerly-assume=false \
4 // RUN: -analyze-function='baruser(int)' -x c++ \
5 // RUN: -verify=nonctu %s
7 // RUN: rm -rf %t && mkdir %t
8 // RUN: mkdir -p %t/ctudir
9 // RUN: %clang_cc1 -std=c++14 -triple x86_64-pc-linux-gnu \
10 // RUN: -emit-pch -o %t/ctudir/ctu-onego-existingdef-other.cpp.ast %S/Inputs/ctu-onego-existingdef-other.cpp
11 // RUN: cp %S/Inputs/ctu-onego-existingdef-other.cpp.externalDefMap.ast-dump.txt %t/ctudir/externalDefMap.txt
13 // Existing and equal function definition in both TU. `other` calls `bar` thus
14 // `bar` will be indirectly imported. During the import we recognize that there
15 // is an existing definition in the main TU, so we don't create a new Decl.
16 // Thus, ctu should not bifurcate on the call of `bar` it should directly
17 // inlinie that as in the case of nonctu.
18 // Note, we would not get a warning below, if `bar` is conservatively evaluated.
23 //Here we completely supress the CTU work list execution. We should not
24 //bifurcate on the call of `bar`. (We do not load the foreign AST at all.)
25 // RUN: %clang_analyze_cc1 -std=c++14 -triple x86_64-pc-linux-gnu \
26 // RUN: -analyzer-checker=core,debug.ExprInspection \
27 // RUN: -analyzer-config eagerly-assume=false \
28 // RUN: -analyzer-config experimental-enable-naive-ctu-analysis=true \
29 // RUN: -analyzer-config ctu-dir=%t/ctudir \
30 // RUN: -verify=stu %s \
31 // RUN: -analyze-function='baruser(int)' -x c++ \
32 // RUN: -analyzer-config ctu-max-nodes-pct=0 \
33 // RUN: -analyzer-config ctu-max-nodes-min=0
35 //Here we enable the CTU work list execution. We should not bifurcate on the
37 // RUN: %clang_analyze_cc1 -std=c++14 -triple x86_64-pc-linux-gnu \
38 // RUN: -analyzer-checker=core,debug.ExprInspection \
39 // RUN: -analyzer-config eagerly-assume=false \
40 // RUN: -analyzer-config experimental-enable-naive-ctu-analysis=true \
41 // RUN: -analyzer-config ctu-dir=%t/ctudir \
42 // RUN: -verify=ctu %s \
43 // RUN: -analyze-function='baruser(int)' -x c++ \
44 // RUN: -analyzer-config ctu-max-nodes-pct=100 \
45 // RUN: -analyzer-config ctu-max-nodes-min=1000
46 //Check that the AST file is loaded.
47 // RUN: %clang_analyze_cc1 -std=c++14 -triple x86_64-pc-linux-gnu \
48 // RUN: -analyzer-checker=core,debug.ExprInspection \
49 // RUN: -analyzer-config eagerly-assume=false \
50 // RUN: -analyzer-config experimental-enable-naive-ctu-analysis=true \
51 // RUN: -analyzer-config ctu-dir=%t/ctudir \
52 // RUN: -analyze-function='baruser(int)' -x c++ \
53 // RUN: -analyzer-config ctu-max-nodes-pct=100 \
54 // RUN: -analyzer-config display-ctu-progress=true \
55 // RUN: -analyzer-config ctu-max-nodes-min=1000 2>&1 %s | FileCheck %s
56 // CHECK: CTU loaded AST file
58 void other(); // Defined in the other TU.
64 // ctu-warning@-1{{Division by zero}}
65 // stu-warning@-2{{Division by zero}}
66 // nonctu-warning@-3{{Division by zero}}