aboutsummaryrefslogtreecommitdiffstats
path: root/safercpp
diff options
context:
space:
mode:
authorduneroadrunner <duneroadrunner@gmail.com>2017-07-18 23:00:46 +0000
committerduneroadrunner <duneroadrunner@gmail.com>2017-07-18 23:00:46 +0000
commit9cfc258d3b10d3579ab3fbe7e626bcefd296171d (patch)
treef7b96d6e1492033c3f1f74ea80679fd722d59325 /safercpp
parentoops, fixed broken preprocessor condition for (diff)
downloadmutator-9cfc258d3b10d3579ab3fbe7e626bcefd296171d.tar.gz
mutator-9cfc258d3b10d3579ab3fbe7e626bcefd296171d.zip
added ASTFrontendActionCompatibilityWrapper1 class to handle an api
difference in different versions of the llvm library
Diffstat (limited to 'safercpp')
-rw-r--r--safercpp/safercpp-arr.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/safercpp/safercpp-arr.cpp b/safercpp/safercpp-arr.cpp
index 1e249f9..22459d1 100644
--- a/safercpp/safercpp-arr.cpp
+++ b/safercpp/safercpp-arr.cpp
@@ -51,7 +51,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.*
/*LLVM Headers*/
#include "llvm/Support/raw_ostream.h"
#include "llvm/IR/Function.h"
-#include "llvm/Config/llvm-config.h" // for LLVM_VERSION_STRING
/**********************************************************************************************************************/
/*used namespaces*/
using namespace llvm;
@@ -6680,8 +6679,19 @@ public:
CompilerInstance &CI;
};
+/* The number of parameters ASTFrontendAction::BeginSourceFileAction() has depends
+ * on the version of the llvm library being used. Using ASTFrontendActionCompatibilityWrapper1
+ * in place of ASTFrontendAction insulates you from this difference based on the
+ * library version being used. */
+class ASTFrontendActionCompatibilityWrapper1 : public ASTFrontendAction {
+public:
+ virtual bool BeginSourceFileAction(CompilerInstance &ci) = 0;
+ virtual bool BeginSourceFileAction(CompilerInstance &ci, StringRef) {
+ return BeginSourceFileAction(ci);
+ }
+};
-class MyFrontendAction : public ASTFrontendAction
+class MyFrontendAction : public ASTFrontendActionCompatibilityWrapper1
{
public:
MyFrontendAction() {
@@ -6694,16 +6704,7 @@ public:
}
}
-#if 5 > LLVM_VERSION_MAJOR
-#define LLVM_OLDER_THAN_r305045
-#endif
-
-#ifdef LLVM_OLDER_THAN_r305045
- bool BeginSourceFileAction(CompilerInstance &ci, StringRef) override {
-#else
bool BeginSourceFileAction(CompilerInstance &ci) override {
-#endif
-
std::unique_ptr<MyPPCallbacks> my_pp_callbacks_ptr(new MyPPCallbacks(TheRewriter, ci));
clang::Preprocessor &pp = ci.getPreprocessor();