aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbloodstalker <thabogre@gmail.com>2017-01-06 22:05:53 +0000
committerbloodstalker <thabogre@gmail.com>2017-01-06 22:05:53 +0000
commit50a343d3844fc48c4cd3a3186b90fd99cb4acc0b (patch)
treede1b1d938f67e7d1461cf7b43881cd8f87287b7a
parentprints out pretty colors for two more fields, mostly used for diagnostics output (diff)
downloadmutator-50a343d3844fc48c4cd3a3186b90fd99cb4acc0b.tar.gz
mutator-50a343d3844fc48c4cd3a3186b90fd99cb4acc0b.zip
added some more overloads
-rw-r--r--mutator_aux.cpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/mutator_aux.cpp b/mutator_aux.cpp
index 6a56352..2671e70 100644
--- a/mutator_aux.cpp
+++ b/mutator_aux.cpp
@@ -92,6 +92,18 @@ bool IsTheMatchInSysHeader(bool SysHeaderFlag, bool SysHeader, SourceLocation SL
return false;
}
}
+
+bool IsTheMatchInSysHeader(bool SysHeaderFlag, bool SysHeader)
+{
+ if (SysHeader && !SysHeaderFlag)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
/*********************************************************************************************************************/
/*********************************************************************************************************************/
/*********************************************************************************************************************/
@@ -133,6 +145,18 @@ bool IsTheMatchInMainFile(bool MainFileFlag, bool MainFile, SourceLocation SL)
return false;
}
}
+
+bool IsTheMatchInMainFile(bool MainFileFlag, bool MainFile)
+{
+ if (MainFile || (!MainFile && !MainFileFlag))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
/*********************************************************************************************************************/
/*********************************************************************************************************************/
/******************************************************XMLReport******************************************************/
@@ -220,6 +244,19 @@ void XMLReport::XMLAddNode(std::string FilePath, std::string MisraRule, std::str
RootPointer->InsertEndChild(MisraElement);
}
+void XMLReport::XMLAddNode(unsigned Line, unsigned Column, std::string FileName, std::string MisraRule, std::string Description)
+{
+ //assert(SL.isValid() && "SourceLocation Acquired by SourceManager in an overload(3) of XMLAddNode is not valid.");
+
+ XMLElement* MisraElement = XMLReportDoc.NewElement("MisraDiag");
+ MisraElement->SetText(Description.c_str());
+ MisraElement->SetAttribute("Misra-C:2004Rule", MisraRule.c_str());
+ MisraElement->SetAttribute("FileName", FileName.c_str());
+ MisraElement->SetAttribute("SpellingLineNumber", Line);
+ MisraElement->SetAttribute("SpellingColumnNumber", Column);
+ RootPointer->InsertEndChild(MisraElement);
+}
+
void XMLReport::SaveReport(void)
{
XMLError XMLErrorResult = XMLReportDoc.SaveFile("./test/misrareport.xml");
@@ -319,6 +356,21 @@ void JSONReport::JSONAddElement(std::string FilePath, std::string MisraRule, std
JSONRepFile << RepJ << std::endl;
}
+void JSONReport::JSONAddElement(unsigned Line, unsigned Column, std::string FileName, std::string MisraRule, std::string Description)
+{
+ //assert(SL.isValid() && "SourceLocation Acquired by SourceManager in an overload(3) of XMLAddNode is not valid.");
+
+ json RepJ;
+
+ RepJ["MisraDiag"]["Description"] = Description.c_str();
+ RepJ["MisraDiag"]["Misra-C:2004Rule"] = MisraRule.c_str();
+ RepJ["MisraDiag"]["FileName"] = FileName.c_str();
+ RepJ["MisraDiag"]["SpellingLineNumber"] = Line;
+ RepJ["MisraDiag"]["SpellingColumnNumber"] = Column;
+
+ JSONRepFile << RepJ << std::endl;
+}
+
void JSONReport::CloseReport(void)
{
JSONRepFile.close();