Clang: Show info bar for parse errors in header files

...because those errors can lead to a substantial performance/functional
regression.

The actual diagnostics (possibly with children) are shown as details in
the info bar.

The info bar can be hidden with the "Do Not Show Again" button.
Re-enabling the info bar is possible with the new editor tool bar
button.

Change-Id: I03394ff8e3c84127946b0b791930b28a385f5a46
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Nikolai Kosjar
2016-10-04 16:23:42 +02:00
parent cb24872f43
commit 9d55d8485c
25 changed files with 458 additions and 44 deletions

View File

@@ -37,6 +37,7 @@ QDebug operator<<(QDebug debug, const DocumentAnnotationsChangedMessage &message
debug.nospace() << "DocumentAnnotationsChangedMessage("
<< message.fileContainer()
<< ", " << message.diagnostics().size()
<< ", " << !message.firstHeaderErrorDiagnostic().text().isEmpty()
<< ", " << message.highlightingMarks().size()
<< ", " << message.skippedPreprocessorRanges().size()
<< ")";
@@ -49,6 +50,7 @@ void PrintTo(const DocumentAnnotationsChangedMessage &message, ::std::ostream* o
*os << "DocumentAnnotationsChangedMessage(";
PrintTo(message.fileContainer(), os);
*os << "," << message.diagnostics().size();
*os << "," << !message.firstHeaderErrorDiagnostic().text().isEmpty();
*os << "," << message.highlightingMarks().size();
*os << "," << message.skippedPreprocessorRanges().size();
*os << ")";

View File

@@ -41,10 +41,12 @@ public:
DocumentAnnotationsChangedMessage() = default;
DocumentAnnotationsChangedMessage(const FileContainer &fileContainer,
const QVector<DiagnosticContainer> &diagnostics,
const DiagnosticContainer &firstHeaderErrorDiagnostic_,
const QVector<HighlightingMarkContainer> &highlightingMarks,
const QVector<SourceRangeContainer> &skippedPreprocessorRanges)
: fileContainer_(fileContainer),
diagnostics_(diagnostics),
firstHeaderErrorDiagnostic_(firstHeaderErrorDiagnostic_),
highlightingMarks_(highlightingMarks),
skippedPreprocessorRanges_(skippedPreprocessorRanges)
{
@@ -60,6 +62,11 @@ public:
return diagnostics_;
}
const DiagnosticContainer &firstHeaderErrorDiagnostic() const
{
return firstHeaderErrorDiagnostic_;
}
const QVector<HighlightingMarkContainer> &highlightingMarks() const
{
return highlightingMarks_;
@@ -74,6 +81,7 @@ public:
{
out << message.fileContainer_;
out << message.diagnostics_;
out << message.firstHeaderErrorDiagnostic_;
out << message.highlightingMarks_;
out << message.skippedPreprocessorRanges_;
@@ -84,6 +92,7 @@ public:
{
in >> message.fileContainer_;
in >> message.diagnostics_;
in >> message.firstHeaderErrorDiagnostic_;
in >> message.highlightingMarks_;
in >> message.skippedPreprocessorRanges_;
@@ -95,6 +104,7 @@ public:
{
return first.fileContainer_ == second.fileContainer_
&& first.diagnostics_ == second.diagnostics_
&& first.firstHeaderErrorDiagnostic_ == second.firstHeaderErrorDiagnostic_
&& first.highlightingMarks_ == second.highlightingMarks_
&& first.skippedPreprocessorRanges_ == second.skippedPreprocessorRanges_;
}
@@ -102,6 +112,7 @@ public:
private:
FileContainer fileContainer_;
QVector<DiagnosticContainer> diagnostics_;
DiagnosticContainer firstHeaderErrorDiagnostic_;
QVector<HighlightingMarkContainer> highlightingMarks_;
QVector<SourceRangeContainer> skippedPreprocessorRanges_;
};