brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · c228757 Raw
52 lines · cpp
1// RUN: rm -rf %t && mkdir %t2// RUN: mkdir -p %t/ctudir3// 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.cpp5// RUN: cp %S/Inputs/ctu-onego-small-other.cpp.externalDefMap.ast-dump.txt %t/ctudir/externalDefMap.txt6 7// Small function defined in another TU.8int bar();9 10// Here we limit the ctu analysis to the first phase only (via the11// ctu-max-nodes config options). And we check whether the small foreign12// 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 %s23// CHECK: ANALYZE (Path,  Inline_Regular): {{.*}} baruser(int){{.*}}CTU loaded AST file24 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 %s33 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 %s42 43 44void clang_analyzer_eval(int);45 46void 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