[ELF] Avoid make in elf::writeARMCmseImportLib
[llvm-project.git] / clang / test / Analysis / analyzer-note-analysis-entry-points.cpp
blob7d321bfae61c9de0ee20151dac7e2e4d78d6935f
1 // RUN: %clang_analyze_cc1 -verify=common %s \
2 // RUN: -analyzer-checker=deadcode.DeadStores,debug.ExprInspection \
3 // RUN: -analyzer-note-analysis-entry-points
5 // RUN: %clang_analyze_cc1 -verify=common,textout %s \
6 // RUN: -analyzer-checker=deadcode.DeadStores,debug.ExprInspection \
7 // RUN: -analyzer-note-analysis-entry-points \
8 // RUN: -analyzer-output=text
10 // Test the actual source locations/ranges of entry point notes.
11 // RUN: %clang_analyze_cc1 %s \
12 // RUN: -analyzer-checker=deadcode.DeadStores,debug.ExprInspection \
13 // RUN: -analyzer-note-analysis-entry-points \
14 // RUN: -analyzer-output=text 2>&1 \
15 // RUN: | FileCheck --strict-whitespace %s
18 void clang_analyzer_warnIfReached();
20 void other() {
21 // common-warning@+1 {{REACHABLE}} textout-note@+1 {{REACHABLE}}
22 clang_analyzer_warnIfReached();
25 struct SomeOtherStruct {
26 // CHECK: note: [debug] analyzing from SomeOtherStruct::f()
27 // CHECK-NEXT: | void f() {
28 // CHECK-NEXT: | ^
29 // textout-note@+1 {{[debug] analyzing from SomeOtherStruct::f()}}
30 void f() {
31 other(); // textout-note {{Calling 'other'}}
35 // CHECK: note: [debug] analyzing from operator""_w(const char *)
36 // CHECK-NEXT: | unsigned operator ""_w(const char*) {
37 // CHECK-NEXT: | ^
38 // textout-note@+1 {{[debug] analyzing from operator""_w(const char *)}}
39 unsigned operator ""_w(const char*) {
40 // common-warning@+1 {{REACHABLE}} textout-note@+1 {{REACHABLE}}
41 clang_analyzer_warnIfReached();
42 return 404;
45 // textout-note@+1 {{[debug] analyzing from checkASTCodeBodyHasAnalysisEntryPoints()}}
46 void checkASTCodeBodyHasAnalysisEntryPoints() {
47 int z = 1;
48 z = 2;
49 // common-warning@-1 {{Value stored to 'z' is never read}}
50 // textout-note@-2 {{Value stored to 'z' is never read}}
53 void notInvokedLambdaScope() {
54 // CHECK: note: [debug] analyzing from notInvokedLambdaScope()::(anonymous class)::operator()()
55 // CHECK-NEXT: | auto notInvokedLambda = []() {
56 // CHECK-NEXT: | ^
57 // textout-note@+1 {{[debug] analyzing from notInvokedLambdaScope()::(anonymous class)::operator()()}}
58 auto notInvokedLambda = []() {
59 // common-warning@+1 {{REACHABLE}} textout-note@+1 {{REACHABLE}}
60 clang_analyzer_warnIfReached();
62 (void)notInvokedLambda; // Not invoking the lambda.
65 // CHECK: note: [debug] analyzing from invokedLambdaScope()
66 // CHECK-NEXT: | void invokedLambdaScope() {
67 // CHECK-NEXT: | ^
68 // textout-note@+1 {{[debug] analyzing from invokedLambdaScope()}}
69 void invokedLambdaScope() {
70 auto invokedLambda = []() {
71 // common-warning@+1 {{REACHABLE}} textout-note@+1 {{REACHABLE}}
72 clang_analyzer_warnIfReached();
74 invokedLambda(); // textout-note {{Calling 'operator()'}}