summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--clang-plugin/gerror-checker.cpp12
-rw-r--r--clang-plugin/gerror-checker.h9
-rw-r--r--configure.ac3
3 files changed, 22 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;
diff --git a/configure.ac b/configure.ac
index 89ef86a..ab6e12b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -91,6 +91,9 @@ AC_DEFINE_UNQUOTED([LLVM_CONFIG_VERSION],"$llvm_version",
AS_IF([test "$major" -ge 8],[
AC_DEFINE([HAVE_LLVM_8_0], [1], [Whether LLVM ≥ 8.0 is available])
])
+AS_IF([test "$major" -ge 9],[
+ AC_DEFINE([HAVE_LLVM_9_0], [1], [Whether LLVM ≥ 9.0 is available])
+])
# Clang dependency (e.g. the clang-devel package on Fedora)
AC_LANG_PUSH([C++])