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,
|
||||
// function TextDiagnostic::printDiagnosticLevel (llvm-3.6.2).
|
||||
static const QStringList categoryPrefixes = {
|
||||
QStringLiteral("note"),
|
||||
QStringLiteral("remark"),
|
||||
QStringLiteral("warning"),
|
||||
QStringLiteral("error"),
|
||||
QStringLiteral("fatal error")
|
||||
QStringLiteral("note: "),
|
||||
QStringLiteral("remark: "),
|
||||
QStringLiteral("warning: "),
|
||||
QStringLiteral("error: "),
|
||||
QStringLiteral("fatal error: ")
|
||||
};
|
||||
|
||||
for (const QString &prefix : categoryPrefixes) {
|
||||
const QString fullPrefix = prefix + QStringLiteral(": ");
|
||||
for (const QString &fullPrefix : categoryPrefixes) {
|
||||
if (theText.startsWith(fullPrefix)) {
|
||||
theText.remove(0, fullPrefix.length());
|
||||
return theText;
|
||||
|
Reference in New Issue
Block a user