From 50a343d3844fc48c4cd3a3186b90fd99cb4acc0b Mon Sep 17 00:00:00 2001 From: bloodstalker Date: Sat, 7 Jan 2017 01:35:53 +0330 Subject: added some more overloads --- mutator_aux.cpp | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) 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(); -- cgit v1.2.3