From b64793999546ed8adebaeebd9d8345d18db8927d Mon Sep 17 00:00:00 2001 From: patrick Date: Mon, 3 Aug 2020 15:06:44 +0000 Subject: Remove LLVM 8.0.1 files. --- .../examples/analyzer-plugin/MainCallChecker.cpp | 54 ---------------------- 1 file changed, 54 deletions(-) delete mode 100644 gnu/llvm/tools/clang/examples/analyzer-plugin/MainCallChecker.cpp (limited to 'gnu/llvm/tools/clang/examples/analyzer-plugin/MainCallChecker.cpp') diff --git a/gnu/llvm/tools/clang/examples/analyzer-plugin/MainCallChecker.cpp b/gnu/llvm/tools/clang/examples/analyzer-plugin/MainCallChecker.cpp deleted file mode 100644 index 77316d696de..00000000000 --- a/gnu/llvm/tools/clang/examples/analyzer-plugin/MainCallChecker.cpp +++ /dev/null @@ -1,54 +0,0 @@ -#include "clang/StaticAnalyzer/Core/Checker.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 < check::PreStmt > { - mutable std::unique_ptr BT; - -public: - void checkPreStmt(const CallExpr *CE, CheckerContext &C) const; -}; -} // end anonymous namespace - -void MainCallChecker::checkPreStmt(const CallExpr *CE, CheckerContext &C) const { - const Expr *Callee = CE->getCallee(); - const FunctionDecl *FD = C.getSVal(Callee).getAsFunctionDecl(); - - if (!FD) - return; - - // Get the name of the callee. - IdentifierInfo *II = FD->getIdentifier(); - if (!II) // if no identifier, not a simple C function - return; - - if (II->isStr("main")) { - ExplodedNode *N = C.generateErrorNode(); - if (!N) - return; - - if (!BT) - BT.reset(new BugType(this, "call to main", "example analyzer plugin")); - - std::unique_ptr report = - llvm::make_unique(*BT, BT->getName(), N); - report->addRange(Callee->getSourceRange()); - C.emitReport(std::move(report)); - } -} - -// Register plugin! -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; -- cgit v1.2.3-59-g8ed1b