| 1 |
// RUN: rm -rf %t && mkdir %t |
| 2 |
// RUN: mkdir -p %t/ctudir |
| 3 |
// RUN: %clang_cc1 -std=c++14 -triple x86_64-pc-linux-gnu \ |
| 4 |
// RUN: -emit-pch -o %t/ctudir/ctu-onego-indirect-other.cpp.ast %S/Inputs/ctu-onego-indirect-other.cpp |
| 5 |
// RUN: cp %S/Inputs/ctu-onego-indirect-other.cpp.externalDefMap.ast-dump.txt %t/ctudir/externalDefMap.txt |
| 6 |
|
| 7 |
int bar(); |
| 8 |
|
| 9 |
// Here we have a foreign function `bar` that is imported when we analyze |
| 10 |
// `adirectbaruser`. During the subsequent toplevel analysis of `baruser` we |
| 11 |
// should bifurcate on the call of `bar`. |
| 12 |
|
| 13 |
//Ensure the order of the toplevel analyzed functions. |
| 14 |
// RUN: %clang_analyze_cc1 -std=c++14 -triple x86_64-pc-linux-gnu \ |
| 15 |
// RUN: -analyzer-checker=core,debug.ExprInspection \ |
| 16 |
// RUN: -analyzer-config eagerly-assume=false \ |
| 17 |
// RUN: -analyzer-config experimental-enable-naive-ctu-analysis=true \ |
| 18 |
// RUN: -analyzer-config ctu-dir=%t/ctudir \ |
| 19 |
// RUN: -analyzer-display-progress \ |
| 20 |
// RUN: -analyzer-inlining-mode=all \ |
| 21 |
// RUN: -analyzer-config ctu-phase1-inlining=none \ |
| 22 |
// RUN: -analyzer-config ctu-max-nodes-pct=100 \ |
| 23 |
// RUN: -analyzer-config ctu-max-nodes-min=1000 2>&1 %s | FileCheck %s |
| 24 |
// CHECK: ANALYZE (Path, Inline_Regular):{{.*}}adirectbaruser(int) |
| 25 |
// CHECK: ANALYZE (Path, Inline_Regular):{{.*}}baruser(int) |
| 26 |
|
| 27 |
// RUN: %clang_analyze_cc1 -std=c++14 -triple x86_64-pc-linux-gnu \ |
| 28 |
// RUN: -analyzer-checker=core,debug.ExprInspection \ |
| 29 |
// RUN: -analyzer-config eagerly-assume=false \ |
| 30 |
// RUN: -analyzer-config experimental-enable-naive-ctu-analysis=true \ |
| 31 |
// RUN: -analyzer-config ctu-dir=%t/ctudir \ |
| 32 |
// RUN: -analyzer-display-progress \ |
| 33 |
// RUN: -analyzer-inlining-mode=all \ |
| 34 |
// RUN: -analyzer-config ctu-phase1-inlining=none \ |
| 35 |
// RUN: -verify %s \ |
| 36 |
// RUN: -analyzer-config ctu-max-nodes-pct=100 \ |
| 37 |
// RUN: -analyzer-config ctu-max-nodes-min=1000 |
| 38 |
|
| 39 |
|
| 40 |
void other(); // Defined in the other TU. |
| 41 |
|
| 42 |
void clang_analyzer_eval(int); |
| 43 |
|
| 44 |
void baruser(int x) { |
| 45 |
if (x == 1) |
| 46 |
return; |
| 47 |
int y = bar(); |
| 48 |
clang_analyzer_eval(y == 0); // expected-warning{{TRUE}} |
| 49 |
// expected-warning@-1{{UNKNOWN}} |
| 50 |
other(); |
| 51 |
} |
| 52 |
|
| 53 |
void adirectbaruser(int) { |
| 54 |
int y = bar(); |
| 55 |
(void)y; |
| 56 |
baruser(1); |
| 57 |
} |
| 58 |
|