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-small-other.cpp.ast %S/Inputs/ctu-onego-small-other.cpp 5 // RUN: cp %S/Inputs/ctu-onego-small-other.cpp.externalDefMap.ast-dump.txt %t/ctudir/externalDefMap.txt 6 7 // Small function defined in another TU. 8 int bar(); 9 10 // Here we limit the ctu analysis to the first phase only (via the 11 // ctu-max-nodes config options). And we check whether the small foreign 12 // function `bar` is inlined. 13 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-config display-ctu-progress=true \ 20 // RUN: -analyzer-display-progress \ 21 // RUN: -analyzer-config ctu-max-nodes-pct=0 \ 22 // RUN: -analyzer-config ctu-max-nodes-min=0 2>&1 %s | FileCheck %s 23 // CHECK: ANALYZE (Path, Inline_Regular): {{.*}} baruser(int){{.*}}CTU loaded AST file 24 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: -analyzer-config ctu-max-nodes-pct=0 \ 31 // RUN: -analyzer-config ctu-phase1-inlining=none \ 32 // RUN: -analyzer-config ctu-max-nodes-min=0 -verify=inline-none %s 33 34 // RUN: %clang_analyze_cc1 -std=c++14 -triple x86_64-pc-linux-gnu \ 35 // RUN: -analyzer-checker=core,debug.ExprInspection \ 36 // RUN: -analyzer-config eagerly-assume=false \ 37 // RUN: -analyzer-config experimental-enable-naive-ctu-analysis=true \ 38 // RUN: -analyzer-config ctu-dir=%t/ctudir \ 39 // RUN: -analyzer-config ctu-max-nodes-pct=0 \ 40 // RUN: -analyzer-config ctu-phase1-inlining=small \ 41 // RUN: -analyzer-config ctu-max-nodes-min=0 -verify=inline-small %s 42 43 44 void clang_analyzer_eval(int); 45 46 void baruser(int x) { 47 int y = bar(); 48 // inline-none-warning@+2{{UNKNOWN}} 49 // inline-small-warning@+1{{TRUE}} 50 clang_analyzer_eval(y == 0); 51 } 52