1*b3c0014eSBalazs Benics int fizzbuzz(int x, bool y) { 2*b3c0014eSBalazs Benics return x + y; 3*b3c0014eSBalazs Benics } 4*b3c0014eSBalazs Benics 5*b3c0014eSBalazs Benics // C++ but not uses parentheses in the '-analyze-function' option. 6*b3c0014eSBalazs Benics // 7*b3c0014eSBalazs Benics // RUN: %clang_analyze_cc1 -analyzer-checker=core \ 8*b3c0014eSBalazs Benics // RUN: -analyze-function='missing_fn' -x c++ \ 9*b3c0014eSBalazs Benics // RUN: -triple x86_64-pc-linux-gnu 2>&1 %s \ 10*b3c0014eSBalazs Benics // RUN: | FileCheck %s -check-prefix=CHECK-CXX 11*b3c0014eSBalazs Benics // 12*b3c0014eSBalazs Benics // CHECK-CXX: Every top-level function was skipped. 13*b3c0014eSBalazs Benics // CHECK-CXX-NEXT: Pass the -analyzer-display-progress for tracking which functions are analyzed. 14*b3c0014eSBalazs Benics // CHECK-CXX-NEXT: For analyzing C++ code you need to pass the function parameter list: -analyze-function="foobar(int, _Bool)" 15*b3c0014eSBalazs Benics 16*b3c0014eSBalazs Benics // C but uses parentheses in the '-analyze-function' option. 17*b3c0014eSBalazs Benics // 18*b3c0014eSBalazs Benics // RUN: %clang_analyze_cc1 -analyzer-checker=core \ 19*b3c0014eSBalazs Benics // RUN: -analyze-function='missing_fn()' -x c -Dbool=_Bool \ 20*b3c0014eSBalazs Benics // RUN: -triple x86_64-pc-linux-gnu 2>&1 %s \ 21*b3c0014eSBalazs Benics // RUN: | FileCheck %s -check-prefix=CHECK-C 22*b3c0014eSBalazs Benics // 23*b3c0014eSBalazs Benics // CHECK-C: Every top-level function was skipped. 24*b3c0014eSBalazs Benics // CHECK-C-NEXT: Pass the -analyzer-display-progress for tracking which functions are analyzed. 25*b3c0014eSBalazs Benics // CHECK-C-NEXT: For analyzing C code you shouldn't pass the function parameter list, only the name of the function: -analyze-function=foobar 26*b3c0014eSBalazs Benics 27*b3c0014eSBalazs Benics // The user passed the '-analyzer-display-progress' option, we don't need to advocate it. 28*b3c0014eSBalazs Benics // 29*b3c0014eSBalazs Benics // RUN: %clang_analyze_cc1 -analyzer-checker=core \ 30*b3c0014eSBalazs Benics // RUN: -analyze-function=missing_fn \ 31*b3c0014eSBalazs Benics // RUN: -analyzer-display-progress -x c -Dbool=_Bool \ 32*b3c0014eSBalazs Benics // RUN: -triple x86_64-pc-linux-gnu 2>&1 %s \ 33*b3c0014eSBalazs Benics // RUN: | FileCheck %s -check-prefix=CHECK-DONT-ADVOCATE-DISPLAY-PROGRESS 34*b3c0014eSBalazs Benics // 35*b3c0014eSBalazs Benics // CHECK-DONT-ADVOCATE-DISPLAY-PROGRESS: Every top-level function was skipped. 36*b3c0014eSBalazs Benics // CHECK-DONT-ADVOCATE-DISPLAY-PROGRESS-NOT: Pass the -analyzer-display-progress 37*b3c0014eSBalazs Benics 38*b3c0014eSBalazs Benics // The user passed the '-analyze-function' option but that doesn't mach to any declaration. 39*b3c0014eSBalazs Benics // 40*b3c0014eSBalazs Benics // RUN: %clang_analyze_cc1 -analyzer-checker=core \ 41*b3c0014eSBalazs Benics // RUN: -analyze-function='missing_fn()' -x c++ \ 42*b3c0014eSBalazs Benics // RUN: -triple x86_64-pc-linux-gnu 2>&1 %s \ 43*b3c0014eSBalazs Benics // RUN: | FileCheck %s -check-prefix=CHECK-ADVOCATE-DISPLAY-PROGRESS 44*b3c0014eSBalazs Benics // 45*b3c0014eSBalazs Benics // CHECK-ADVOCATE-DISPLAY-PROGRESS: Every top-level function was skipped. 46*b3c0014eSBalazs Benics // CHECK-ADVOCATE-DISPLAY-PROGRESS-NEXT: Pass the -analyzer-display-progress for tracking which functions are analyzed. 47*b3c0014eSBalazs Benics // CHECK-ADVOCATE-DISPLAY-PROGRESS-NOT: For analyzing 48*b3c0014eSBalazs Benics 49*b3c0014eSBalazs Benics // The user passed the '-analyze-function' option and that matches on a 50*b3c0014eSBalazs Benics // declaration in C mode. 51*b3c0014eSBalazs Benics // 52*b3c0014eSBalazs Benics // RUN: %clang_analyze_cc1 -analyzer-checker=core \ 53*b3c0014eSBalazs Benics // RUN: -analyze-function='fizzbuzz' -x c -Dbool=_Bool \ 54*b3c0014eSBalazs Benics // RUN: -triple x86_64-pc-linux-gnu 2>&1 %s \ 55*b3c0014eSBalazs Benics // RUN: | FileCheck %s -check-prefix=CHECK-EMPTY2 --allow-empty 56*b3c0014eSBalazs Benics // 57*b3c0014eSBalazs Benics // Expected empty standard output. 58*b3c0014eSBalazs Benics // CHECK-EMPTY2-NOT: Every top-level function was skipped. 59*b3c0014eSBalazs Benics 60*b3c0014eSBalazs Benics // Same as the previous but syntax mode only. 61*b3c0014eSBalazs Benics // FIXME: This should have empty standard output. 62*b3c0014eSBalazs Benics // 63*b3c0014eSBalazs Benics // RUN: %clang_analyze_cc1 -analyzer-checker=core -analyzer-config ipa=none \ 64*b3c0014eSBalazs Benics // RUN: -analyze-function='fizzbuzz(int, _Bool)' -x c++ \ 65*b3c0014eSBalazs Benics // RUN: -triple x86_64-pc-linux-gnu 2>&1 %s \ 66*b3c0014eSBalazs Benics // RUN: | FileCheck %s -check-prefix=CHECK-EMPTY3 --allow-empty 67*b3c0014eSBalazs Benics // 68*b3c0014eSBalazs Benics // FIXME: This should have empty standard output. 69*b3c0014eSBalazs Benics // CHECK-EMPTY3: Every top-level function was skipped. 70*b3c0014eSBalazs Benics // CHECK-EMPTY3-NEXT: Pass the -analyzer-display-progress for tracking which functions are analyzed. 71