From dc22658993ae658bca4ed8bae0e4fcb219059de4 Mon Sep 17 00:00:00 2001 From: bloodstalker Date: Mon, 26 Nov 2018 17:38:43 +0330 Subject: introducing cgrep, a new addition to the mutator family. updated the readme for bruiser. some minor changes to the wasm setter test script. things look more or less fine. i still need to add a repackage function to faultreiber. --- m0/mutator-lvl0.cpp | 40 +++------------------------------------- 1 file changed, 3 insertions(+), 37 deletions(-) (limited to 'm0') diff --git a/m0/mutator-lvl0.cpp b/m0/mutator-lvl0.cpp index d8dfc46..f6663dd 100644 --- a/m0/mutator-lvl0.cpp +++ b/m0/mutator-lvl0.cpp @@ -5436,41 +5436,19 @@ class SFCPPARR02SUB : public MatchFinder::MatchCallback if (MR.Nodes.getNodeAs("sfcpp02sub") != nullptr) { const DeclRefExpr* DRE = MR.Nodes.getNodeAs("sfcpp02sub"); - SourceManager *const SM = MR.SourceManager; - SourceLocation SL = DRE->DEVI_GETLOCSTART(); CheckSLValidity(SL); - //SL = Devi::SourceLocationHasMacro(SL, Rewrite, "start"); SL = SM->getSpellingLoc(SL); - - if (Devi::IsTheMatchInSysHeader(CheckSystemHeader, MR, SL)) - { - return void(); - } - - if (!Devi::IsTheMatchInMainFile(MainFileOnly, MR, SL)) - { - return void(); - } - + if (Devi::IsTheMatchInSysHeader(CheckSystemHeader, MR, SL)) {return void();} + if (!Devi::IsTheMatchInMainFile(MainFileOnly, MR, SL)) {return void();} const NamedDecl* ND = DRE->getFoundDecl(); - SourceLocation OriginSL = ND->DEVI_GETLOCSTART(); CheckSLValidity(OriginSL); - //OriginSL = Devi::SourceLocationHasMacro(OriginSL, Rewrite, "start"); OriginSL = SM->getSpellingLoc(OriginSL); - StringRef OriginFileName [[maybe_unused]] = SM->getFilename(OriginSL); -#if 0 - std::cout << "GarbageOut" << ":" << "Origin:" << DRE->getFoundDecl()->getName().str() << "\n"; - std::cout << "GarbageOut" << ":" << "Origin:" << ExtOriginFileName.str() << ":" << "Proto:" << OriginFileName.str() << "\n"; - std::cout << "GarbageOut" << ":" << "Origin:" << ExtOriginSL.printToString(*SM) << ":" << "Proto:" << OriginSL.printToString(*SM) << "\n"; -#endif - - if (OriginSL == ExtOriginSL && OriginFileName == ExtOriginFileName) - { + if (OriginSL == ExtOriginSL && OriginFileName == ExtOriginFileName) { std::cout << "SaferCPP01" << ":" << "Native Array used - pointer points to an array:" << SL.printToString(*MR.SourceManager) << ":" << DRE->getFoundDecl()->getName().str() << "\n"; } @@ -5508,29 +5486,17 @@ class SFCPPARR02 : public MatchFinder::MatchCallback if (MR.Nodes.getNodeAs("sfcpparrdeep") != nullptr) { const DeclRefExpr* DRE = MR.Nodes.getNodeAs("sfcpparrdeep"); - ASTContext *const ASTC = MR.Context; - SourceManager *const SM = MR.SourceManager; - SourceLocation SL = DRE->DEVI_GETLOCSTART(); CheckSLValidity(SL); SL = SM->getSpellingLoc(SL); - const NamedDecl* ND = DRE->getFoundDecl(); - StringRef NDName = ND->getName(); - SubHandler.setOriginSourceLocation(SM->getSpellingLoc(ND->DEVI_GETLOCSTART())); SubHandler.setOriginFileName(SM->getFilename(SM->getSpellingLoc(ND->DEVI_GETLOCSTART()))); - Matcher.addMatcher(declRefExpr(to(varDecl(hasName(NDName.str())))).bind("sfcpp02sub"), &SubHandler); - Matcher.matchAST(*ASTC); - -#if 0 - std::cout << "GarbageOutOrigin" << ":" << "GarbageOutOrigin:" << SL.printToString(*MR.SourceManager) << ":" << NDName.str() << "\n"; -#endif } } -- cgit v1.2.3