xml: output file0 whenever it is different to filename, both for included files and when #line is used.
This commit is contained in:
parent
5ab8c20d8e
commit
dc5e2d5c8d
|
@ -27,7 +27,6 @@
|
||||||
#include "xmlreport.h"
|
#include "xmlreport.h"
|
||||||
#include "xmlreportv2.h"
|
#include "xmlreportv2.h"
|
||||||
#include "cppcheck.h"
|
#include "cppcheck.h"
|
||||||
#include "path.h"
|
|
||||||
|
|
||||||
static const char ResultElementName[] = "results";
|
static const char ResultElementName[] = "results";
|
||||||
static const char CppcheckElementName[] = "cppcheck";
|
static const char CppcheckElementName[] = "cppcheck";
|
||||||
|
@ -122,7 +121,7 @@ void XmlReportV2::WriteError(const ErrorItem &error)
|
||||||
mXmlWriter->writeStartElement(LocationElementName);
|
mXmlWriter->writeStartElement(LocationElementName);
|
||||||
|
|
||||||
QString file = QDir::toNativeSeparators(error.files[i]);
|
QString file = QDir::toNativeSeparators(error.files[i]);
|
||||||
if (Path::isHeader(file.toStdString()) && !error.file0.isEmpty()) {
|
if (!error.file0.isEmpty() && file != error.file0) {
|
||||||
mXmlWriter->writeAttribute(IncludedFromFilenameAttribute, quoteMessage(error.file0));
|
mXmlWriter->writeAttribute(IncludedFromFilenameAttribute, quoteMessage(error.file0));
|
||||||
}
|
}
|
||||||
file = XmlReport::quoteMessage(file);
|
file = XmlReport::quoteMessage(file);
|
||||||
|
|
|
@ -287,7 +287,7 @@ std::string ErrorLogger::ErrorMessage::toXML(bool verbose, int version) const
|
||||||
|
|
||||||
for (std::list<FileLocation>::const_reverse_iterator it = _callStack.rbegin(); it != _callStack.rend(); ++it) {
|
for (std::list<FileLocation>::const_reverse_iterator it = _callStack.rbegin(); it != _callStack.rend(); ++it) {
|
||||||
printer.OpenElement("location", false);
|
printer.OpenElement("location", false);
|
||||||
if (Path::isHeader((*it).getfile()) && !file0.empty())
|
if (!file0.empty() && (*it).getfile() != file0)
|
||||||
printer.PushAttribute("file0", Path::toNativeSeparators(file0).c_str());
|
printer.PushAttribute("file0", Path::toNativeSeparators(file0).c_str());
|
||||||
printer.PushAttribute("file", (*it).getfile().c_str());
|
printer.PushAttribute("file", (*it).getfile().c_str());
|
||||||
printer.PushAttribute("line", (*it).line);
|
printer.PushAttribute("line", (*it).line);
|
||||||
|
|
Loading…
Reference in New Issue