brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.9 KiB · e260fc4 Raw
63 lines · cpp
1int fizzbuzz(int x, bool y) {2  return x + y;3}4 5// C++ but not uses parentheses in the '-analyze-function' option.6//7// RUN: %clang_analyze_cc1 -analyzer-checker=core \8// RUN:   -analyze-function='missing_fn' -x c++ \9// RUN:   -triple x86_64-pc-linux-gnu 2>&1 %s \10// RUN: | FileCheck %s -check-prefix=CHECK-CXX11//12// CHECK-CXX:      Every top-level function was skipped.13// CHECK-CXX-NEXT: Pass the -analyzer-display-progress for tracking which functions are analyzed.14// CHECK-CXX-NEXT: For analyzing C++ code you need to pass the function parameter list: -analyze-function="foobar(int, _Bool)"15 16// C but uses parentheses in the '-analyze-function' option.17//18// RUN: %clang_analyze_cc1 -analyzer-checker=core \19// RUN:   -analyze-function='missing_fn()' -x c -Dbool=_Bool \20// RUN:   -triple x86_64-pc-linux-gnu 2>&1 %s \21// RUN: | FileCheck %s -check-prefix=CHECK-C22//23// CHECK-C:      Every top-level function was skipped.24// CHECK-C-NEXT: Pass the -analyzer-display-progress for tracking which functions are analyzed.25// CHECK-C-NEXT: For analyzing C code you shouldn't pass the function parameter list, only the name of the function: -analyze-function=foobar26 27// The user passed the '-analyzer-display-progress' option, we don't need to advocate it.28//29// RUN: %clang_analyze_cc1 -analyzer-checker=core \30// RUN:   -analyze-function=missing_fn \31// RUN:   -analyzer-display-progress -x c -Dbool=_Bool \32// RUN:   -triple x86_64-pc-linux-gnu 2>&1 %s \33// RUN: | FileCheck %s -check-prefix=CHECK-DONT-ADVOCATE-DISPLAY-PROGRESS34//35// CHECK-DONT-ADVOCATE-DISPLAY-PROGRESS:     Every top-level function was skipped.36// CHECK-DONT-ADVOCATE-DISPLAY-PROGRESS-NOT: Pass the -analyzer-display-progress37 38// The user passed the '-analyze-function' option but that doesn't mach to any declaration.39//40// RUN: %clang_analyze_cc1 -analyzer-checker=core \41// RUN:   -analyze-function='missing_fn()' -x c++ \42// RUN:   -triple x86_64-pc-linux-gnu 2>&1 %s \43// RUN: | FileCheck %s -check-prefix=CHECK-ADVOCATE-DISPLAY-PROGRESS44//45// CHECK-ADVOCATE-DISPLAY-PROGRESS:      Every top-level function was skipped.46// CHECK-ADVOCATE-DISPLAY-PROGRESS-NEXT: Pass the -analyzer-display-progress for tracking which functions are analyzed.47// CHECK-ADVOCATE-DISPLAY-PROGRESS-NOT:  For analyzing48 49// The user only enables syntax-only analysis, like `debug.DumpDominators`.50// `-analyze-function` should only match the given function.51//52// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.DumpDominators -analyzer-config ipa=none \53// RUN:   -analyze-function='fizzbuzz(int, _Bool)' -x c++ \54// RUN:   -triple x86_64-pc-linux-gnu 2>&1 %s \55// RUN: | FileCheck %s -check-prefix=CHECK-SYNTAX-ONLY --allow-empty56//57// With syntax-only analysis, the function is found and analyzed, so no error message.58// CHECK-SYNTAX-ONLY:      Immediate dominance tree (Node#,IDom#):59// CHECK-SYNTAX-ONLY-NEXT: (0,1)60// CHECK-SYNTAX-ONLY-NEXT: (1,2)61// CHECK-SYNTAX-ONLY-NEXT: (2,2)62// CHECK-SYNTAX-ONLY-NOT: Every top-level function was skipped.63