forked from qt-creator/qt-creator
ClangCodemodel: Avoid repeated construction of category prefixes
Change-Id: I0166010a17f1f37855862f28cc9e2472b638c9de Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -76,15 +76,14 @@ QString diagnosticCategoryPrefixRemoved(const QString &text)
|
|||||||
// Prefixes are taken from $LLVM_SOURCE_DIR/tools/clang/lib/Frontend/TextDiagnostic.cpp,
|
// Prefixes are taken from $LLVM_SOURCE_DIR/tools/clang/lib/Frontend/TextDiagnostic.cpp,
|
||||||
// function TextDiagnostic::printDiagnosticLevel (llvm-3.6.2).
|
// function TextDiagnostic::printDiagnosticLevel (llvm-3.6.2).
|
||||||
static const QStringList categoryPrefixes = {
|
static const QStringList categoryPrefixes = {
|
||||||
QStringLiteral("note"),
|
QStringLiteral("note: "),
|
||||||
QStringLiteral("remark"),
|
QStringLiteral("remark: "),
|
||||||
QStringLiteral("warning"),
|
QStringLiteral("warning: "),
|
||||||
QStringLiteral("error"),
|
QStringLiteral("error: "),
|
||||||
QStringLiteral("fatal error")
|
QStringLiteral("fatal error: ")
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const QString &prefix : categoryPrefixes) {
|
for (const QString &fullPrefix : categoryPrefixes) {
|
||||||
const QString fullPrefix = prefix + QStringLiteral(": ");
|
|
||||||
if (theText.startsWith(fullPrefix)) {
|
if (theText.startsWith(fullPrefix)) {
|
||||||
theText.remove(0, fullPrefix.length());
|
theText.remove(0, fullPrefix.length());
|
||||||
return theText;
|
return theText;
|
||||||
|
Reference in New Issue
Block a user