diff options
author | bloodstalker <thabogre@gmail.com> | 2016-11-30 09:48:39 +0000 |
---|---|---|
committer | bloodstalker <thabogre@gmail.com> | 2016-11-30 09:48:39 +0000 |
commit | a1a73adef03871151e297401746f8d72af06122d (patch) | |
tree | df8dacf9d8c417b2f304f55a425364cbf47c536b | |
parent | output samples for the misra rule checker (diff) | |
download | mutator-a1a73adef03871151e297401746f8d72af06122d.tar.gz mutator-a1a73adef03871151e297401746f8d72af06122d.zip |
added an overloaded member function for XMLReport to add nodes to the xml doc
-rw-r--r-- | mutator_aux.cpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/mutator_aux.cpp b/mutator_aux.cpp index f4af533..a17af14 100644 --- a/mutator_aux.cpp +++ b/mutator_aux.cpp @@ -73,17 +73,23 @@ void XMLReport::XMLAddNode(ASTContext* ASTC, SourceLocation SL, std::string Misr MisraElement->SetAttribute("SpellingLineNumber", LineNumber); MisraElement->SetAttribute("SpellingColumnNumber", ColumnNumber); RootPointer->InsertEndChild(MisraElement); +} + +void XMLReport::XMLAddNode(FullSourceLoc FullSrcLoc, SourceLocation SL, std::string MisraRule, std::string Description) +{ + unsigned LineNumber = FullSrcLoc.getSpellingLineNumber(); + unsigned ColumnNumber = FullSrcLoc.getSpellingColumnNumber(); + const SourceManager& SM = FullSrcLoc.getManager(); + std::string FileNameString = SM.getFilename(SL).str(); -#if 0 - XMLElement* pElement = XMLReportDoc.NewElement("SourceLocation"); - pElement->SetText("rule:filename:line:column"); - pElement->SetAttribute("rule", "17.4"); - pElement->SetAttribute("filename", "testFuncs2.c"); - pElement->SetAttribute("line", 67); - pElement->SetAttribute("column", 12); - RootPointer->InsertEndChild(pElement); -#endif + XMLElement* MisraElement = XMLReportDoc.NewElement("MisraDiag"); + MisraElement->SetText(Description.c_str()); + MisraElement->SetAttribute("Misra-C:2004Rule", MisraRule.c_str()); + MisraElement->SetAttribute("FileName", FileNameString.c_str()); + MisraElement->SetAttribute("SpellingLineNumber", LineNumber); + MisraElement->SetAttribute("SpellingColumnNumber", ColumnNumber); + RootPointer->InsertEndChild(MisraElement); } void XMLReport::SaveReport(void) |