diff options
Diffstat (limited to 'clang-plugin')
-rw-r--r-- | clang-plugin/gerror-checker.cpp | 12 | ||||
-rw-r--r-- | clang-plugin/gerror-checker.h | 9 |
2 files changed, 19 insertions, 2 deletions
diff --git a/clang-plugin/gerror-checker.cpp b/clang-plugin/gerror-checker.cpp index 8301a44..df9f5c7 100644 --- a/clang-plugin/gerror-checker.cpp +++ b/clang-plugin/gerror-checker.cpp @@ -505,9 +505,19 @@ GErrorChecker::checkPreCall (const CallEvent &call, /* Dispatch call-evaluation events to the different per-function handlers. * Return true iff the call was evaluated. */ bool -GErrorChecker::evalCall (const CallExpr *call, +GErrorChecker::evalCall ( +#ifdef HAVE_LLVM_9_0 + const CallEvent &call_event, +#else + const CallExpr *call, +#endif CheckerContext &context) const { +#ifdef HAVE_LLVM_9_0 + const CallExpr *call = llvm::dyn_cast<CallExpr>(call_event.getOriginExpr()); + if (!call) + return false; +#endif const FunctionDecl *func_decl = context.getCalleeDecl (call); if (func_decl == NULL || diff --git a/clang-plugin/gerror-checker.h b/clang-plugin/gerror-checker.h index 5fdff0e..1d7ce80 100644 --- a/clang-plugin/gerror-checker.h +++ b/clang-plugin/gerror-checker.h @@ -23,6 +23,8 @@ #ifndef TARTAN_GERROR_CHECKER_H #define TARTAN_GERROR_CHECKER_H +#include "config.h" + #include <clang/AST/AST.h> #include <clang/StaticAnalyzer/Core/BugReporter/BugType.h> #include <clang/StaticAnalyzer/Core/Checker.h> @@ -159,7 +161,12 @@ private: public: void checkPreCall (const CallEvent &call, CheckerContext &context) const; - bool evalCall (const CallExpr *call, + bool evalCall ( +#ifdef HAVE_LLVM_9_0 + const CallEvent &call_event, +#else + const CallExpr *call, +#endif CheckerContext &context) const; void checkBind (SVal loc, SVal val, const Stmt *stmt, CheckerContext &context) const; |