aboutsummaryrefslogtreecommitdiffstats
path: root/mutator-lvl0.cpp
diff options
context:
space:
mode:
authorbloodstalker <thabogre@gmail.com>2017-01-02 20:44:21 +0000
committerbloodstalker <thabogre@gmail.com>2017-01-02 20:44:21 +0000
commit9032353b1d18a950e90a37f022dff4b5dec77400 (patch)
tree149482abf8a7efd4ee7a02d681a54f57f889f2d0 /mutator-lvl0.cpp
parentadded a comment (diff)
downloadmutator-9032353b1d18a950e90a37f022dff4b5dec77400.tar.gz
mutator-9032353b1d18a950e90a37f022dff4b5dec77400.zip
added a new options...not working. apparently the llvm::cl tutorial is outdated.
Diffstat (limited to '')
-rw-r--r--mutator-lvl0.cpp28
1 files changed, 19 insertions, 9 deletions
diff --git a/mutator-lvl0.cpp b/mutator-lvl0.cpp
index 0881f4d..3772791 100644
--- a/mutator-lvl0.cpp
+++ b/mutator-lvl0.cpp
@@ -56,7 +56,9 @@ enum MisraC
};
static llvm::cl::OptionCategory MutatorLVL0Cat("mutator-lvl0 options category");
+/*@DEVI-the option has been added since gcc does it.its as simple as that.*/
cl::opt<bool> CheckSystemHeader("SysHeader", cl::desc("mutator-lvl0 will run through System Headers"));
+cl::opt<bool> MainFileOnly("MainOnly", cl::desc("mutator-lvl0 will only report the results that reside in the main file"));
cl::opt<MisraC> MisraCVersion(cl::desc("choose the MisraC version to check against"), \
cl::values(clEnumVal(MisraC2004, "Misra-C:2004"), clEnumVal(MisraC2012, "Misra-C:2012"), \
clEnumVal(C2, "Misra-C:2004"), clEnumVal(C3, "Misra-C:2012")));
@@ -240,11 +242,14 @@ public:
return void();
}
- std::cout << "15.2:" << "\"SwitchStmt\" has a caseStmt that's missing a breakStmt:";
- std::cout << SL.printToString(*MR.SourceManager) << ":" << std::endl;
+ if (Devi::IsTheMatchInMainFile(MainFileOnly, MR, SL))
+ {
+ std::cout << "15.2:" << "\"SwitchStmt\" has a caseStmt that's missing a breakStmt:";
+ std::cout << SL.printToString(*MR.SourceManager) << ":" << std::endl;
- XMLDocOut.XMLAddNode(MR.Context, SL, "15.2", "\"SwitchStmt\" has a caseStmt that's missing a breakStmt: ");
- JSONDocOUT.JSONAddElement(MR.Context, SL, "15.2", "\"SwitchStmt\" has a caseStmt that's missing a breakStmt: ");
+ XMLDocOut.XMLAddNode(MR.Context, SL, "15.2", "\"SwitchStmt\" has a caseStmt that's missing a breakStmt: ");
+ JSONDocOUT.JSONAddElement(MR.Context, SL, "15.2", "\"SwitchStmt\" has a caseStmt that's missing a breakStmt: ");
+ }
}
else
{
@@ -2149,7 +2154,7 @@ public:
std::string NameString = DNI.getAsString();
/*JANKY*/
- /*the third condition is put in place to accomodate the prefix unary increment or decrement operator.*/
+ /*@DEVI-the third condition is put in place to accomodate the prefix unary increment or decrement operator.*/
if (SLFSInit == SL || SLFSInc == SL || SLFSInc.getLocWithOffset(2) == SL)
{
ControlVarName = NameString;
@@ -4074,6 +4079,8 @@ public:
QualType QT = PVD->getOriginalType();
+ ASTContext *const ASTC = MR.Context;
+
if (!QT.isConstQualified())
{
if (Devi::IsTheMatchInSysHeader(CheckSystemHeader, MR, SL))
@@ -4082,11 +4089,14 @@ public:
}
else
{
- std::cout << "16.7:" << "pointerType ParmVarDecl is not used to change the contents of the object it points to but is not declared as const:";
- std::cout << SL.printToString(*MR.SourceManager) << ":" << std::endl;
+ if (Devi::IsTheMatchInMainFile(MainFileOnly, MR, SL))
+ {
+ std::cout << "16.7:" << "pointerType ParmVarDecl is not used to change the contents of the object it points to but is not declared as const:";
+ std::cout << SL.printToString(*MR.SourceManager) << ":" << std::endl;
- XMLDocOut.XMLAddNode(MR.Context, SL, "16.7", "pointerType ParmVarDecl is not used to change the contents of the object it points to but is not declared as const : ");
- JSONDocOUT.JSONAddElement(MR.Context, SL, "16.7", "pointerType ParmVarDecl is not used to change the contents of the object it points to but is not declared as const : ");
+ XMLDocOut.XMLAddNode(MR.Context, SL, "16.7", "pointerType ParmVarDecl is not used to change the contents of the object it points to but is not declared as const : ");
+ JSONDocOUT.JSONAddElement(MR.Context, SL, "16.7", "pointerType ParmVarDecl is not used to change the contents of the object it points to but is not declared as const : ");
+ }
}
}
}