brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.1 KiB · 92a48de Raw
121 lines · c
1// REQUIRES: plugins2 3// FIXME: This test fails on clang-stage2-cmake-RgSan,4// see also https://reviews.llvm.org/D62445#16132685// UNSUPPORTED: target={{.*darwin.*}}6 7// RUN: %clang_analyze_cc1 -verify %s \8// RUN:   -load %llvmshlibdir/SampleAnalyzerPlugin%pluginext \9// RUN:   -analyzer-checker='example.MainCallChecker'10 11// Test that the MainCallChecker example analyzer plugin loads and runs.12 13int main();14 15void caller() {16  main(); // expected-warning {{call to main}}17}18 19// RUN: %clang_analyze_cc1 %s \20// RUN:   -load %llvmshlibdir/CheckerDependencyHandlingAnalyzerPlugin%pluginext\21// RUN:   -analyzer-checker=example.DependendentChecker \22// RUN:   -analyzer-list-enabled-checkers \23// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-IMPLICITLY-ENABLED24 25// CHECK-IMPLICITLY-ENABLED: example.Dependency26// CHECK-IMPLICITLY-ENABLED: example.DependendentChecker27 28// RUN: %clang_analyze_cc1 %s \29// RUN:   -load %llvmshlibdir/CheckerDependencyHandlingAnalyzerPlugin%pluginext\30// RUN:   -analyzer-checker=example.DependendentChecker \31// RUN:   -analyzer-disable-checker=example.Dependency \32// RUN:   -analyzer-list-enabled-checkers \33// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-IMPLICITLY-DISABLED34 35// CHECK-IMPLICITLY-DISABLED-NOT: example.Dependency36// CHECK-IMPLICITLY-DISABLED-NOT: example.DependendentChecker37 38// RUN: %clang_analyze_cc1 %s \39// RUN:   -load %llvmshlibdir/CheckerOptionHandlingAnalyzerPlugin%pluginext\40// RUN:   -analyzer-checker=example.MyChecker \41// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-CHECKER-OPTION-OUTPUT42 43// CHECK-CHECKER-OPTION-OUTPUT: Example option is set to false44 45// RUN: %clang_analyze_cc1 %s \46// RUN:   -load %llvmshlibdir/CheckerOptionHandlingAnalyzerPlugin%pluginext\47// RUN:   -analyzer-checker=example.MyChecker \48// RUN:   -analyzer-config example.MyChecker:ExampleOption=true \49// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-CHECKER-OPTION-OUTPUT-TRUE50 51// CHECK-CHECKER-OPTION-OUTPUT-TRUE: Example option is set to true52 53// RUN: %clang_analyze_cc1 %s \54// RUN:   -load %llvmshlibdir/CheckerOptionHandlingAnalyzerPlugin%pluginext\55// RUN:   -analyzer-checker=example.MyChecker \56// RUN:   -analyzer-checker=debug.ConfigDumper \57// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-CHECKER-OPTION58 59// CHECK-CHECKER-OPTION: example.MyChecker:ExampleOption = false60 61// RUN: %clang_analyze_cc1 %s \62// RUN:   -load %llvmshlibdir/CheckerOptionHandlingAnalyzerPlugin%pluginext\63// RUN:   -analyzer-checker=example.MyChecker \64// RUN:   -analyzer-checker=debug.ConfigDumper \65// RUN:   -analyzer-config example.MyChecker:ExampleOption=true \66// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-CHECKER-OPTION-TRUE67 68// CHECK-CHECKER-OPTION-TRUE: example.MyChecker:ExampleOption = true69 70// RUN: not %clang_analyze_cc1 -verify %s \71// RUN:   -load %llvmshlibdir/CheckerOptionHandlingAnalyzerPlugin%pluginext\72// RUN:   -analyzer-checker=example.MyChecker \73// RUN:   -analyzer-config example.MyChecker:Example=true \74// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-NON-EXISTENT-CHECKER-OPTION75 76// CHECK-NON-EXISTENT-CHECKER-OPTION: (frontend): checker 'example.MyChecker'77// CHECK-NON-EXISTENT-CHECKER-OPTION-SAME: has no option called 'Example'78 79// RUN: not %clang_analyze_cc1 -verify %s \80// RUN:   -load %llvmshlibdir/CheckerOptionHandlingAnalyzerPlugin%pluginext\81// RUN:   -analyzer-checker=example.MyChecker \82// RUN:   -analyzer-config-compatibility-mode=true \83// RUN:   -analyzer-config example.MyChecker:Example=true84 85 86// RUN: not %clang_analyze_cc1 -verify %s \87// RUN:   -load %llvmshlibdir/CheckerOptionHandlingAnalyzerPlugin%pluginext\88// RUN:   -analyzer-checker=example.MyChecker \89// RUN:   -analyzer-config example.MyChecker:ExampleOption=example \90// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-INVALID-BOOL-VALUE91 92// CHECK-INVALID-BOOL-VALUE: (frontend): invalid input for checker option93// CHECK-INVALID-BOOL-VALUE-SAME: 'example.MyChecker:ExampleOption', that94// CHECK-INVALID-BOOL-VALUE-SAME: expects a boolean value95 96// RUN: not %clang_analyze_cc1 -verify %s \97// RUN:   -load %llvmshlibdir/CheckerOptionHandlingAnalyzerPlugin%pluginext\98// RUN:   -analyzer-checker=example.MyChecker \99// RUN:   -analyzer-config-compatibility-mode=true \100// RUN:   -analyzer-config example.MyChecker:ExampleOption=example101 102// RUN: %clang_analyze_cc1 %s \103// RUN:   -load %llvmshlibdir/CheckerOptionHandlingAnalyzerPlugin%pluginext\104// RUN:   -analyzer-checker=example.MyChecker \105// RUN:   -analyzer-checker=debug.ConfigDumper \106// RUN:   -analyzer-config-compatibility-mode=true \107// RUN:   -analyzer-config example.MyChecker:ExampleOption=example \108// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-CORRECTED-BOOL-VALUE109 110// CHECK-CORRECTED-BOOL-VALUE: example.MyChecker:ExampleOption = false111 112// RUN: %clang_analyze_cc1 %s \113// RUN:   -load %llvmshlibdir/CheckerOptionHandlingAnalyzerPlugin%pluginext\114// RUN:   -analyzer-checker=example.MyChecker \115// RUN:   -analyzer-checker-option-help \116// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-CHECKER-OPTION-HELP117 118// CHECK-CHECKER-OPTION-HELP: example.MyChecker:ExampleOption  (bool) This is an119// CHECK-CHECKER-OPTION-HELP-SAME: example checker opt. (default:120// CHECK-CHECKER-OPTION-HELP-NEXT: false)121