From: Kristof Umann Date: Wed, 15 May 2019 20:19:51 +0000 (+0000) Subject: Revert "[analyzer] Add a test for plugins using checker dependencies" X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=750a45fe2551b18a12e58f61a5defbdd23a95411;p=platform%2Fupstream%2Fllvm.git Revert "[analyzer] Add a test for plugins using checker dependencies" Buildbots don't seem to find the new plugin. llvm-svn: 360805 --- diff --git a/clang/examples/CMakeLists.txt b/clang/examples/CMakeLists.txt index e4fedf3..8c26548 100644 --- a/clang/examples/CMakeLists.txt +++ b/clang/examples/CMakeLists.txt @@ -3,6 +3,9 @@ if(NOT CLANG_BUILD_EXAMPLES) set(EXCLUDE_FROM_ALL ON) endif() +if(CLANG_ENABLE_STATIC_ANALYZER) +add_subdirectory(analyzer-plugin) +endif() add_subdirectory(clang-interpreter) add_subdirectory(PrintFunctionNames) add_subdirectory(AnnotateFunctions) diff --git a/clang/test/Analysis/plugins/SampleAnalyzer/CMakeLists.txt b/clang/examples/analyzer-plugin/CMakeLists.txt similarity index 100% rename from clang/test/Analysis/plugins/SampleAnalyzer/CMakeLists.txt rename to clang/examples/analyzer-plugin/CMakeLists.txt diff --git a/clang/test/Analysis/plugins/SampleAnalyzer/MainCallChecker.cpp b/clang/examples/analyzer-plugin/MainCallChecker.cpp similarity index 74% rename from clang/test/Analysis/plugins/SampleAnalyzer/MainCallChecker.cpp rename to clang/examples/analyzer-plugin/MainCallChecker.cpp index 8bd4085..77316d6 100644 --- a/clang/test/Analysis/plugins/SampleAnalyzer/MainCallChecker.cpp +++ b/clang/examples/analyzer-plugin/MainCallChecker.cpp @@ -1,13 +1,13 @@ -#include "clang/StaticAnalyzer/Core/BugReporter/BugType.h" #include "clang/StaticAnalyzer/Core/Checker.h" -#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h" +#include "clang/StaticAnalyzer/Core/BugReporter/BugType.h" #include "clang/StaticAnalyzer/Frontend/CheckerRegistry.h" +#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h" using namespace clang; using namespace ento; namespace { -class MainCallChecker : public Checker> { +class MainCallChecker : public Checker < check::PreStmt > { mutable std::unique_ptr BT; public: @@ -15,8 +15,7 @@ public: }; } // end anonymous namespace -void MainCallChecker::checkPreStmt(const CallExpr *CE, - CheckerContext &C) const { +void MainCallChecker::checkPreStmt(const CallExpr *CE, CheckerContext &C) const { const Expr *Callee = CE->getCallee(); const FunctionDecl *FD = C.getSVal(Callee).getAsFunctionDecl(); @@ -25,7 +24,7 @@ void MainCallChecker::checkPreStmt(const CallExpr *CE, // Get the name of the callee. IdentifierInfo *II = FD->getIdentifier(); - if (!II) // if no identifier, not a simple C function + if (!II) // if no identifier, not a simple C function return; if (II->isStr("main")) { @@ -44,11 +43,12 @@ void MainCallChecker::checkPreStmt(const CallExpr *CE, } // Register plugin! -extern "C" void clang_registerCheckers(CheckerRegistry ®istry) { +extern "C" +void clang_registerCheckers (CheckerRegistry ®istry) { registry.addChecker( "example.MainCallChecker", "Disallows calls to functions called main", ""); } -extern "C" const char clang_analyzerAPIVersionString[] = - CLANG_ANALYZER_API_VERSION_STRING; +extern "C" +const char clang_analyzerAPIVersionString[] = CLANG_ANALYZER_API_VERSION_STRING; diff --git a/clang/test/Analysis/plugins/SampleAnalyzer/SampleAnalyzerPlugin.exports b/clang/examples/analyzer-plugin/SampleAnalyzerPlugin.exports similarity index 100% rename from clang/test/Analysis/plugins/SampleAnalyzer/SampleAnalyzerPlugin.exports rename to clang/examples/analyzer-plugin/SampleAnalyzerPlugin.exports diff --git a/clang/test/Analysis/checker-plugins.c b/clang/test/Analysis/checker-plugins.c index f0a5484..ee60ec6 100644 --- a/clang/test/Analysis/checker-plugins.c +++ b/clang/test/Analysis/checker-plugins.c @@ -1,8 +1,5 @@ -// RUN: %clang_analyze_cc1 -verify %s \ -// RUN: -load %llvmshlibdir/SampleAnalyzerPlugin%pluginext \ -// RUN: -analyzer-checker='example.MainCallChecker' - -// REQUIRES: plugins +// RUN: %clang_analyze_cc1 -load %llvmshlibdir/SampleAnalyzerPlugin%pluginext -analyzer-checker='example.MainCallChecker' -verify %s +// REQUIRES: plugins, examples // Test that the MainCallChecker example analyzer plugin loads and runs. @@ -11,22 +8,3 @@ int main(); void caller() { main(); // expected-warning {{call to main}} } - -// RUN: %clang_analyze_cc1 %s \ -// RUN: -load %llvmshlibdir/CheckerDependencyHandlingAnalyzerPlugin%pluginext\ -// RUN: -analyzer-checker=example.DependendentChecker \ -// RUN: -analyzer-list-enabled-checkers \ -// RUN: 2>&1 | FileCheck %s -check-prefix=CHECK-IMPLICITLY-ENABLED - -// CHECK-IMPLICITLY-ENABLED: example.Dependency -// CHECK-IMPLICITLY-ENABLED: example.DependendentChecker - -// RUN: %clang_analyze_cc1 %s \ -// RUN: -load %llvmshlibdir/CheckerDependencyHandlingAnalyzerPlugin%pluginext\ -// RUN: -analyzer-checker=example.DependendentChecker \ -// RUN: -analyzer-disable-checker=example.Dependency \ -// RUN: -analyzer-list-enabled-checkers \ -// RUN: 2>&1 | FileCheck %s -check-prefix=CHECK-IMPLICITLY-DISABLED - -// CHECK-IMPLICITLY-DISABLED-NOT: example.Dependency -// CHECK-IMPLICITLY-DISABLED-NOT: example.DependendentChecker diff --git a/clang/test/Analysis/lit.local.cfg b/clang/test/Analysis/lit.local.cfg index b77cae8..84f7569 100644 --- a/clang/test/Analysis/lit.local.cfg +++ b/clang/test/Analysis/lit.local.cfg @@ -18,7 +18,5 @@ config.substitutions.append(('%diff_plist', config.substitutions.append(('%diff_sarif', '''diff -U1 -w -I ".*file:.*%basename_t" -I '"version":' -I "2\.0\.0\-csd\.[0-9]*\.beta\."''')) -config.excludes.add('plugins') - if not config.root.clang_staticanalyzer: config.unsupported = True diff --git a/clang/test/Analysis/plugins/CMakeLists.txt b/clang/test/Analysis/plugins/CMakeLists.txt deleted file mode 100644 index 3f538d9..0000000 --- a/clang/test/Analysis/plugins/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -add_subdirectory(SampleAnalyzer) -add_subdirectory(CheckerDependencyHandling) - -set(CLANG_ANALYZER_PLUGIN_DEPS - SampleAnalyzerPlugin - CheckerDependencyHandlingAnalyzerPlugin - ) - -add_custom_target(clang-analyzer-plugin - DEPENDS ${CLANG_ANALYZER_PLUGIN_DEPS}) diff --git a/clang/test/Analysis/plugins/CheckerDependencyHandling/CMakeLists.txt b/clang/test/Analysis/plugins/CheckerDependencyHandling/CMakeLists.txt deleted file mode 100644 index 80e2cdb..0000000 --- a/clang/test/Analysis/plugins/CheckerDependencyHandling/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/CheckerDependencyHandlingAnalyzerPlugin.exports) -add_llvm_library(CheckerDependencyHandlingAnalyzerPlugin MODULE CheckerDependencyHandling.cpp PLUGIN_TOOL clang) - -if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN)) - target_link_libraries(CheckerDependencyHandlingAnalyzerPlugin PRIVATE - clangAnalysis - clangAST - clangStaticAnalyzerCore - LLVMSupport - ) -endif() diff --git a/clang/test/Analysis/plugins/CheckerDependencyHandling/CheckerDependencyHandling.cpp b/clang/test/Analysis/plugins/CheckerDependencyHandling/CheckerDependencyHandling.cpp deleted file mode 100644 index be8e120..0000000 --- a/clang/test/Analysis/plugins/CheckerDependencyHandling/CheckerDependencyHandling.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "clang/StaticAnalyzer/Core/BugReporter/BugType.h" -#include "clang/StaticAnalyzer/Core/Checker.h" -#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h" -#include "clang/StaticAnalyzer/Frontend/CheckerRegistry.h" - -using namespace clang; -using namespace ento; - -namespace { -struct Dependency : public Checker { - void checkBeginFunction(CheckerContext &Ctx) const {} -}; -struct DependendentChecker : public Checker { - void checkBeginFunction(CheckerContext &Ctx) const {} -}; -} // end anonymous namespace - -// Register plugin! -extern "C" void clang_registerCheckers(CheckerRegistry ®istry) { - registry.addChecker("example.Dependency", "", ""); - registry.addChecker("example.DependendentChecker", "", - ""); - - registry.addDependency("example.DependendentChecker", "example.Dependency"); -} - -extern "C" const char clang_analyzerAPIVersionString[] = - CLANG_ANALYZER_API_VERSION_STRING; diff --git a/clang/test/Analysis/plugins/CheckerDependencyHandling/CheckerDependencyHandlingAnalyzerPlugin.exports b/clang/test/Analysis/plugins/CheckerDependencyHandling/CheckerDependencyHandlingAnalyzerPlugin.exports deleted file mode 100644 index 8d9ff88..0000000 --- a/clang/test/Analysis/plugins/CheckerDependencyHandling/CheckerDependencyHandlingAnalyzerPlugin.exports +++ /dev/null @@ -1,2 +0,0 @@ -clang_registerCheckers -clang_analyzerAPIVersionString diff --git a/clang/test/CMakeLists.txt b/clang/test/CMakeLists.txt index 43e49d5..65a1d6e9 100644 --- a/clang/test/CMakeLists.txt +++ b/clang/test/CMakeLists.txt @@ -139,15 +139,13 @@ if (CLANG_ENABLE_STATIC_ANALYZER) # check-all would launch those tests via check-clang. set(EXCLUDE_FROM_ALL ON) - add_subdirectory(Analysis/plugins) - list(APPEND CLANG_TEST_DEPS clang-analyzer-plugin) - add_lit_testsuite(check-clang-analyzer "Running the Clang analyzer tests" ${CMAKE_CURRENT_BINARY_DIR}/Analysis PARAMS ${ANALYZER_TEST_PARAMS} DEPENDS ${CLANG_TEST_DEPS}) set_target_properties(check-clang-analyzer PROPERTIES FOLDER "Clang tests") + if (LLVM_WITH_Z3) add_lit_testsuite(check-clang-analyzer-z3 "Running the Clang analyzer tests, using Z3 as a solver" ${CMAKE_CURRENT_BINARY_DIR}/Analysis