From 398fd5f129db52063893098454f99b09633f0054 Mon Sep 17 00:00:00 2001 From: bloodstalker Date: Thu, 5 Dec 2019 17:51:36 +0330 Subject: fixing m0s builds for all llvm versions, added a windows cygwin build test on appveyor --- m0/makefile | 8 ++++++++ m0/mutator-lvl0.cpp | 38 +++++++++++++++++++++++++++----------- m0/mutator-lvl0.h | 2 +- 3 files changed, 36 insertions(+), 12 deletions(-) (limited to 'm0') diff --git a/m0/makefile b/m0/makefile index a9afeaf..cd7f0be 100644 --- a/m0/makefile +++ b/m0/makefile @@ -3,10 +3,18 @@ SHELL=bash SHELL?=bash CC=clang CC?=clang +ifdef OS +CFLAGS=-std=c11 +else CFLAGS=-fpic -std=c11 +endif CXX=clang++ CXX?=clang++ +ifdef OS +CXX_FLAGS=-fpic +else CXX_FLAGS=-fpic +endif CXX_EXTRA?= CTAGS_I_PATH?=./ LD_FLAGS= diff --git a/m0/mutator-lvl0.cpp b/m0/mutator-lvl0.cpp index abbcb52..10cd06a 100644 --- a/m0/mutator-lvl0.cpp +++ b/m0/mutator-lvl0.cpp @@ -4155,7 +4155,11 @@ public: RawCommentList RCL = ASTC->Comments; - ArrayRef RawCommentArrRef = RCL.getComments(); +#if __clang_major__ >= 10 + auto RawComments = RCL.getCommentsInFile(SM.getMainFileID()); +#elif __clang_major__ < 10 + ArrayRef RawComments = RCL.getComments(); +#endif std::string RawText; @@ -4165,11 +4169,23 @@ public: unsigned MatchCounter = 0U; - for (auto &iter : RawCommentArrRef) +#if __clang_major__ >= 10 + for (auto &iter : *RawComments) +#elif __clang_major__ < 10 + for (auto &iter : RawComments) +#endif { +#if __clang_major__ >= 10 + RawText = iter.second->getRawText(SM); +#elif __clang_major__ < 10 RawText = iter->getRawText(SM); +#endif +#if __clang_major__ >= 10 + SourceLocation RCSL = iter.second->DEVI_GETLOCSTART(); +#elif __clang_major__ < 10 SourceLocation RCSL = iter->DEVI_GETLOCSTART(); +#endif CheckSLValidity(RCSL); RCSL = Devi::SourceLocationHasMacro(RCSL, Rewrite, "start"); @@ -4499,9 +4515,9 @@ public: const UnaryOperator* UO = MR.Nodes.getNodeAs("mcexpr1211uno"); clang::UnaryOperator::Opcode UnoOpKind = UO->getOpcode(); const Expr* UnoSubEXP = UO->getSubExpr(); -#if __clang_major__ >= 9 +#if __clang_major__ >= 8 clang::Expr::EvalResult UnoResult; -#elif __clang_major__ < 9 +#elif __clang_major__ < 8 llvm::APSInt UnoResult; UnoFinal = UnoResult.getExtValue(); #endif @@ -4528,20 +4544,20 @@ public: const Expr* DousLHS = BO->getLHS(); const Expr* DousRHS = BO->getRHS(); -#if __clang_major__ >= 9 +#if __clang_major__ >= 8 clang::Expr::EvalResult DousLHSAPS; clang::Expr::EvalResult DousRHSAPS; -#elif __clang_major__ < 9 +#elif __clang_major__ < 8 llvm::APSInt DousLHSAPS; llvm::APSInt DousRHSAPS; #endif if (DousLHS->EvaluateAsInt(DousLHSAPS, *ASTC) && DousRHS->EvaluateAsInt(DousRHSAPS, *ASTC)) { -#if __clang_major__ >= 9 +#if __clang_major__ >= 8 int64_t DousLHSInt64 = DousLHSAPS.Val.getInt().getExtValue(); int64_t DousRHSInt64 = DousRHSAPS.Val.getInt().getExtValue(); -#elif __clang_major__ < 9 +#elif __clang_major__ < 8 int64_t DousLHSInt64 = DousLHSAPS.getExtValue(); int64_t DousRHSInt64 = DousRHSAPS.getExtValue(); #endif @@ -4566,11 +4582,11 @@ public: } } -#if __clang_major__ >= 9 +#if __clang_major__ >= 8 clang::Expr::EvalResult OverflowCondidate; EXP->EvaluateAsInt(OverflowCondidate, *ASTC); int64_t IntExprValue = OverflowCondidate.Val.getInt().getExtValue(); -#elif __clang_major__ < 9 +#elif __clang_major__ < 8 llvm::APSInt OverflowCondidate; EXP->EvaluateAsInt(OverflowCondidate, *ASTC); int64_t IntExprValue = OverflowCondidate.getExtValue(); @@ -5617,7 +5633,7 @@ public: throw MutExHeaderNotFound(FileName.str()); } -#if __clang_major__ <= 6 +#if __clang_major__ <= 7 virtual void InclusionDirective (SourceLocation HashLoc, const Token &IncludeTok, StringRef FileName, \ bool IsAngled, CharSourceRange FileNameRange, const FileEntry* File, \ StringRef SearchPath, StringRef RelativePath, const clang::Module* Imported) { diff --git a/m0/mutator-lvl0.h b/m0/mutator-lvl0.h index 1891fef..982c7ac 100644 --- a/m0/mutator-lvl0.h +++ b/m0/mutator-lvl0.h @@ -38,7 +38,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.* #include "clang/AST/ASTTypeTraits.h" /**********************************************************************************************************************/ /*macros*/ -#if __clang_major__ <= 6 +#if __clang_major__ <= 7 #define DEVI_GETLOCSTART getLocStart #define DEVI_GETLOCEND getLocEnd #elif __clang_major__ >= 8 -- cgit v1.2.3