diff options
author | bloodstalker <thabogre@gmail.com> | 2016-12-31 17:06:37 +0000 |
---|---|---|
committer | bloodstalker <thabogre@gmail.com> | 2016-12-31 17:06:37 +0000 |
commit | 8642eb69bebc218f887dec5a9ae810445e8f9929 (patch) | |
tree | 0fcb721909bb94e1e1c80b25c815130f05bb5c19 /mutator_aux.cpp | |
parent | previously added 10.3 and 10.4. now adding 5.3 and 5.4. (diff) | |
download | mutator-8642eb69bebc218f887dec5a9ae810445e8f9929.tar.gz mutator-8642eb69bebc218f887dec5a9ae810445e8f9929.zip |
added some helper functions to support the new mutator-lvl0 cl options
Diffstat (limited to '')
-rw-r--r-- | mutator_aux.cpp | 91 |
1 files changed, 90 insertions, 1 deletions
diff --git a/mutator_aux.cpp b/mutator_aux.cpp index 0d74e68..a27878a 100644 --- a/mutator_aux.cpp +++ b/mutator_aux.cpp @@ -8,6 +8,7 @@ #include <iostream> #include <fstream> #include "clang/AST/AST.h" +#include "clang/ASTMatchers/ASTMatchFinder.h" #include "clang/Basic/SourceManager.h" #include "clang/Rewrite/Core/Rewriter.h" #include "tinyxml2/tinyxml2.h" @@ -50,6 +51,91 @@ SourceLocation SourceLocationHasMacro (SourceLocation SL, Rewriter &Rewrite, std return (SL); } +/*********************************************************************************************************************/ +/*********************************************************************************************************************/ +/*********************************************************************************************************************/ +/*the first argument is the option SysHeader from the mutator-lvl0 cl.*/ +bool IsTheMatchInSysHeader(bool SysHeaderFlag, const ast_matchers::MatchFinder::MatchResult &MR, SourceLocation SL) +{ + ASTContext *const ASTC = MR.Context; + const SourceManager &SM = ASTC->getSourceManager(); + + if (SM.isInSystemHeader(SL) && !SysHeaderFlag) + { + return true; + } + else + { + return false; + } +} + +bool IsTheMatchInSysHeader(bool SysHeaderFlag, const SourceManager &SM, SourceLocation SL) +{ + if (SM.isInSystemHeader(SL) && !SysHeaderFlag) + { + return true; + } + else + { + return false; + } +} + +bool IsTheMatchInSysHeader(bool SysHeaderFlag, bool SysHeader, SourceLocation SL) +{ + if (SysHeader && !SysHeaderFlag) + { + return true; + } + else + { + return false; + } +} +/*********************************************************************************************************************/ +/*********************************************************************************************************************/ +/*********************************************************************************************************************/ +bool IsTheMatchInMainFile(bool MainFileFlag, const ast_matchers::MatchFinder::MatchResult &MR, SourceLocation SL) +{ + ASTContext *const ASTC = MR.Context; + const SourceManager &SM = ASTC->getSourceManager(); + + if (SM.isInMainFile(SL) && !MainFileFlag) + { + return true; + } + else + { + return false; + } +} + +bool IsTheMatchInMainFile(bool MainFileFlag, const SourceManager &SM, SourceLocation SL) +{ + if (SM.isInMainFile(SL) && !MainFileFlag) + { + return true; + } + else + { + return false; + } +} + +bool IsTheMatchInMainFile(bool MainFileFlag, bool MainFile, SourceLocation SL) +{ + if (MainFile && !MainFileFlag) + { + return true; + } + else + { + return false; + } +} +/*********************************************************************************************************************/ +/*********************************************************************************************************************/ /******************************************************XMLReport******************************************************/ XMLReport::XMLReport() { @@ -134,7 +220,7 @@ void XMLReport::SaveReport(void) } } /***************************************************End of XMLReport**************************************************/ - +/*********************************************************************************************************************/ /*****************************************************JSONReport******************************************************/ JSONReport::JSONReport() {} @@ -213,7 +299,10 @@ void JSONReport::CloseReport(void) { JSONRepFile.close(); } +/*********************************************************************************************************************/ /****************************************************End Of JSONReport************************************************/ +/*********************************************************************************************************************/ +/*End of namespace Devi*/ } /*********************************************************************************************************************/ /*last line intentionally left blank.*/ |