aboutsummaryrefslogtreecommitdiffstats
path: root/bruiser
diff options
context:
space:
mode:
authorbloodstalker <thabogre@gmail.com>2018-09-29 11:21:57 +0000
committerbloodstalker <thabogre@gmail.com>2018-09-29 11:21:57 +0000
commitcf4e229615f84653e47ec54a3035eb2ff1f454cc (patch)
tree0d66615902490610ad9d8ebbcd4befb1f5776e3c /bruiser
parentdid some code cleanup on m0 and bruiser, now you can specify report paths for... (diff)
downloadmutator-cf4e229615f84653e47ec54a3035eb2ff1f454cc.tar.gz
mutator-cf4e229615f84653e47ec54a3035eb2ff1f454cc.zip
with a few minor tweaks, you can build m0, obfuscator and bruiser with llvm 8.0(latest tested:trunk 340121). we are skipping llvm 7.0. Ill keep backwards compatibility with 5.0 or 6.0 for a good while.
Diffstat (limited to 'bruiser')
-rw-r--r--bruiser/bruiser.cpp24
-rw-r--r--bruiser/bruiser.h8
2 files changed, 20 insertions, 12 deletions
diff --git a/bruiser/bruiser.cpp b/bruiser/bruiser.cpp
index ae6db23..726f963 100644
--- a/bruiser/bruiser.cpp
+++ b/bruiser/bruiser.cpp
@@ -661,10 +661,10 @@ public:
if (MR.Nodes.getNodeAs<clang::FunctionDecl>("mainwrapper") != nullptr) {
const FunctionDecl* FD = MR.Nodes.getNodeAs<clang::FunctionDecl>("mainwrapper");
- SourceLocation SL = FD->getLocStart();
+ SourceLocation SL = FD->DEVI_GETLOCSTART();
CheckSLValidity(SL);
SL = Devi::SourceLocationHasMacro(SL, Rewrite);
- SourceLocation SLE = FD->getLocEnd();
+ SourceLocation SLE = FD->DEVI_GETLOCEND();
CheckSLValidity(SLE);
SLE = Devi::SourceLocationHasMacro(SLE, Rewrite);
@@ -695,7 +695,7 @@ class LiveListFuncs : public MatchFinder::MatchCallback {
if (MR.Nodes.getNodeAs<clang::FunctionDecl>("livelistfuncs") != nullptr) {
const clang::FunctionDecl* FD = MR.Nodes.getNodeAs<clang::FunctionDecl>("livelistfuncs");
- SourceLocation SL = FD->getLocStart();
+ SourceLocation SL = FD->DEVI_GETLOCSTART();
CheckSLValidity(SL);
SL = Devi::SourceLocationHasMacro(SL, R);
@@ -705,13 +705,13 @@ class LiveListFuncs : public MatchFinder::MatchCallback {
if (FD->hasBody()) {
Stmt* Body = FD->getBody();
- SourceLocation SLBody = Body->getLocStart();
- SourceLocation SLShebang = FD->getLocStart();
+ SourceLocation SLBody = Body->DEVI_GETLOCSTART();
+ SourceLocation SLShebang = FD->DEVI_GETLOCSTART();
PRINT_WITH_COLOR_LB(CYAN, R.getRewrittenText(clang::SourceRange(SLShebang, SLBody.getLocWithOffset(-1))).c_str());
PushToLua.push_back(R.getRewrittenText(clang::SourceRange(SLShebang, SLBody.getLocWithOffset(-1))));
} else {
- SourceLocation SL = FD->getLocStart();
- SourceLocation SLE = FD->getLocEnd();
+ SourceLocation SL = FD->DEVI_GETLOCSTART();
+ SourceLocation SLE = FD->DEVI_GETLOCEND();
PRINT_WITH_COLOR_LB(CYAN, R.getRewrittenText(clang::SourceRange(SL, SLE)).c_str());
PushToLua.push_back(R.getRewrittenText(clang::SourceRange(SL, SLE)));
}
@@ -730,7 +730,7 @@ class LiveListVars : public MatchFinder::MatchCallback {
if (MR.Nodes.getNodeAs<clang::VarDecl>("livelistvars") != nullptr) {
const clang::VarDecl* VD = MR.Nodes.getNodeAs<clang::VarDecl>("livelistvars");
- SourceLocation SL = VD->getLocStart();
+ SourceLocation SL = VD->DEVI_GETLOCSTART();
CheckSLValidity(SL);
SL = Devi::SourceLocationHasMacro(SL, R);
@@ -738,8 +738,8 @@ class LiveListVars : public MatchFinder::MatchCallback {
return void();
}
- PRINT_WITH_COLOR_LB(CYAN, R.getRewrittenText(SourceRange(VD->getLocStart(), VD->getLocEnd())).c_str());
- PushToLua.push_back(R.getRewrittenText(SourceRange(VD->getLocStart(), VD->getLocEnd())));
+ PRINT_WITH_COLOR_LB(CYAN, R.getRewrittenText(SourceRange(VD->DEVI_GETLOCSTART(), VD->DEVI_GETLOCEND())).c_str());
+ PushToLua.push_back(R.getRewrittenText(SourceRange(VD->DEVI_GETLOCSTART(), VD->DEVI_GETLOCEND())));
}
}
@@ -755,8 +755,8 @@ class LiveListRecords : public MatchFinder::MatchCallback {
if (MR.Nodes.getNodeAs<clang::RecordDecl>("livelistvars") != nullptr) {
const clang::RecordDecl* RD = MR.Nodes.getNodeAs<clang::RecordDecl>("livelistvars");
- PRINT_WITH_COLOR_LB(CYAN, R.getRewrittenText(SourceRange(RD->getLocStart(), RD->getLocEnd())).c_str());
- PushToLua.push_back(R.getRewrittenText(SourceRange(RD->getLocStart(), RD->getLocEnd())));
+ PRINT_WITH_COLOR_LB(CYAN, R.getRewrittenText(SourceRange(RD->DEVI_GETLOCSTART(), RD->DEVI_GETLOCEND())).c_str());
+ PushToLua.push_back(R.getRewrittenText(SourceRange(RD->DEVI_GETLOCSTART(), RD->DEVI_GETLOCEND())));
}
}
diff --git a/bruiser/bruiser.h b/bruiser/bruiser.h
index 1e54d34..d91bae2 100644
--- a/bruiser/bruiser.h
+++ b/bruiser/bruiser.h
@@ -47,6 +47,14 @@ namespace bruiser
/**********************************************************************************************************************/
const char* M0REP = "../test/misrareport.xml";
/**********************************************************************************************************************/
+#if __clang_major__ <= 6
+#define DEVI_GETLOCSTART getLocStart
+#define DEVI_GETLOCEND getLocEnd
+#elif __clang_major__ >= 8
+#define DEVI_GETLOCSTART getBeginLoc
+#define DEVI_GETLOCEND getEndLoc
+#endif
+
#define JOIN2(x1, x2) x1##x2
#define JOIN3(x1, x2, x3) x1##x2##x3