brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.7 KiB · dc1f3f3 Raw
48 lines · cpp
1// REQUIRES: shell2// REQUIRES: custom-check3 4// RUN: sed -e "s:INPUT_DIR:%S/Inputs/custom-query-check:g" -e "s:OUT_DIR:%t:g" -e "s:MAIN_FILE:%s:g" %S/Inputs/custom-query-check/vfsoverlay.yaml > %t.yaml5// RUN: clang-tidy --experimental-custom-checks %t/main.cpp -checks='-*,custom-*' -vfsoverlay %t.yaml | FileCheck %s --check-prefix=CHECK-SAME-DIR6// RUN: clang-tidy --experimental-custom-checks %t/subdir/main.cpp -checks='-*,custom-*' -vfsoverlay %t.yaml | FileCheck %s --check-prefix=CHECK-SUB-DIR-BASE7// RUN: clang-tidy --experimental-custom-checks %t/subdir-override/main.cpp -checks='-*,custom-*' -vfsoverlay %t.yaml | FileCheck %s --check-prefix=CHECK-SUB-DIR-OVERRIDE8// RUN: clang-tidy --experimental-custom-checks %t/subdir-empty/main.cpp -checks='-*,custom-*' -vfsoverlay %t.yaml --allow-no-checks | FileCheck %s --check-prefix=CHECK-SUB-DIR-EMPTY9// RUN: clang-tidy --experimental-custom-checks %t/subdir-append/main.cpp -checks='-*,custom-*' -vfsoverlay %t.yaml | FileCheck %s --check-prefix=CHECK-SUB-DIR-APPEND10// RUN: clang-tidy --experimental-custom-checks %t/subdir-append/main.cpp -checks='-*,custom-*' -vfsoverlay %t.yaml --list-checks | FileCheck %s --check-prefix=LIST-CHECK11// RUN: clang-tidy --experimental-custom-checks %t/subdir-append/main.cpp -checks='-*,custom-*' -vfsoverlay %t.yaml --dump-config | FileCheck %s --check-prefix=DUMP-CONFIG12 13 14long V;15// CHECK-SAME-DIR: [[@LINE-1]]:1: warning: use 'int' instead of 'long' [custom-avoid-long-type]16// CHECK-SUB-DIR-BASE: [[@LINE-2]]:1: warning: use 'int' instead of 'long' [custom-avoid-long-type]17// CHECK-SUB-DIR-OVERRIDE: [[@LINE-3]]:1: warning: use 'int' instead of 'long' override [custom-avoid-long-type]18// CHECK-SUB-DIR-EMPTY: No checks enabled.19// CHECK-SUB-DIR-APPEND: [[@LINE-5]]:1: warning: use 'int' instead of 'long' [custom-avoid-long-type]20 21void f();22// CHECK-SUB-DIR-APPEND: [[@LINE-1]]:1: warning: find function decl [custom-function-decl]23 24// LIST-CHECK: Enabled checks:25// LIST-CHECK:   custom-avoid-long-type26// LIST-CHECK:   custom-function-decl27 28// DUMP-CONFIG: CustomChecks:29// DUMP-CONFIG: - Name: avoid-long-type30// DUMP-CONFIG:   Query: |31// DUMP-CONFIG:     match varDecl(32// DUMP-CONFIG:       hasType(asString("long")),33// DUMP-CONFIG:       hasTypeLoc(typeLoc().bind("long"))34// DUMP-CONFIG:     )35// DUMP-CONFIG:   Diagnostic:36// DUMP-CONFIG:    - BindName: long37// DUMP-CONFIG:      Message: |38// DUMP-CONFIG:           use 'int' instead of 'long'39// DUMP-CONFIG:      Level:           Warning40// DUMP-CONFIG: - Name: function-decl41// DUMP-CONFIG:   Query: |42// DUMP-CONFIG:     match functionDecl().bind("func")43// DUMP-CONFIG:   Diagnostic:44// DUMP-CONFIG:    - BindName: func45// DUMP-CONFIG:      Message: |46// DUMP-CONFIG:        find function decl47// DUMP-CONFIG:   Level: Warning48