aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbloodstalker <thabogre@gmail.com>2016-11-25 13:28:38 +0000
committerbloodstalker <thabogre@gmail.com>2016-11-25 13:28:38 +0000
commitdbf8a44cf29b0c82d5298459e586edbbfbd84b81 (patch)
treed06b13483b2fa41b303634a629fb0683cc320ef5
parentadded tdd tests for 13.1 and 13.2 (diff)
downloadmutator-dbf8a44cf29b0c82d5298459e586edbbfbd84b81.tar.gz
mutator-dbf8a44cf29b0c82d5298459e586edbbfbd84b81.zip
added 13.3
-rw-r--r--mutator-lvl0.cpp50
1 files changed, 49 insertions, 1 deletions
diff --git a/mutator-lvl0.cpp b/mutator-lvl0.cpp
index 5b57cd1..9bd49b3 100644
--- a/mutator-lvl0.cpp
+++ b/mutator-lvl0.cpp
@@ -1216,6 +1216,51 @@ private:
Rewriter &Rewrite;
};
/**********************************************************************************************************************/
+class MCCSE1332 : public MatchFinder::MatchCallback
+{
+public:
+ MCCSE1332 (Rewriter &Rewrite) : Rewrite (Rewrite) {}
+
+ virtual void run(const MatchFinder::MatchResult &MR)
+ {
+ if (MR.Nodes.getNodeAs<clang::Expr>("mccse1332rl") != nullptr)
+ {
+ const Expr* EXP = MR.Nodes.getNodeAs<clang::Expr>("mccse1332rl");
+ const BinaryOperator* BO = MR.Nodes.getNodeAs<clang::BinaryOperator>("mccse1332daddy");
+
+ SourceLocation SLD = BO->getLocStart();
+ SLD = Devi::SourceLocationHasMacro(SLD, Rewrite, "start");
+ NewSL = SLD;
+
+ SourceLocation SL = EXP->getLocStart();
+ SL = Devi::SourceLocationHasMacro(SL, Rewrite, "start");
+
+ QualType QT = EXP->getType();
+
+ const clang::Type* TP = QT.getTypePtr();
+
+ if (OldSL != NewSL)
+ {
+ if (TP->hasFloatingRepresentation())
+ {
+ std::cout << "13.3 : " << "Float type expression checked for equality/inequality: " << std::endl;
+ std::cout << SL.printToString(*MR.SourceManager) << "\n" << std::endl;
+ }
+ }
+
+ OldSL = NewSL;
+ }
+ }
+
+private:
+ SourceLocation NewSL;
+ SourceLocation OldSL;
+
+ Rewriter &Rewrite;
+};
+/**********************************************************************************************************************/
+/**********************************************************************************************************************/
+/**********************************************************************************************************************/
/**********************************************************************************************************************/
/**********************************************************************************************************************/
class MyASTConsumer : public ASTConsumer {
@@ -1227,7 +1272,7 @@ public:
HandlerForFunction169(R), HandlerForPA171(R), HandlerForSU184(R), HandlerForType6465(R), HandlerForDCDF81(R), HandlerForDCDF82(R), \
HandlerForInit91(R), HandlerForInit92(R), HandlerForInit93(R), HandlerForExpr123(R), HandlerForExpr124(R), HandlerForExpr125(R), \
HandlerForExpr126(R), HandlerForExpr127(R), HandlerForExpr128(R), HandlerForExpr129(R), HandlerForExpr1210(R), HandlerForExpr1213(R), \
- HandlerForCSE131(R), HandlerForCSE132(R) {
+ HandlerForCSE131(R), HandlerForCSE132(R), HandlerForCSE1332(R) {
/*forstmts whithout a compound statement.*/
Matcher.addMatcher(forStmt(unless(hasDescendant(compoundStmt()))).bind("mcfor"), &HandlerForCmpless);
@@ -1307,6 +1352,8 @@ public:
Matcher.addMatcher(ifStmt(hasCondition(expr(unless(hasDescendant(binaryOperator(anyOf(hasOperatorName("<")\
, hasOperatorName(">"), hasOperatorName("=="), hasOperatorName("<="), hasOperatorName(">=")))))).bind("mccse132"))), &HandlerForCSE132);
+ Matcher.addMatcher(binaryOperator(allOf(anyOf(hasOperatorName("<"), hasOperatorName(">"), hasOperatorName("<="), hasOperatorName(">="), hasOperatorName("==")), \
+ eachOf(hasLHS(expr().bind("mccse1332rl")), hasRHS(expr().bind("mccse1332rl"))))).bind("mccse1332daddy"), &HandlerForCSE1332);
}
void HandleTranslationUnit(ASTContext &Context) override {
@@ -1348,6 +1395,7 @@ private:
MCExpr1213 HandlerForExpr1213;
MCCSE131 HandlerForCSE131;
MCCSE132 HandlerForCSE132;
+ MCCSE1332 HandlerForCSE1332;
MatchFinder Matcher;
};
/**********************************************************************************************************************/