forked from qt-creator/qt-creator
ClangCodeModel: Fix displaying diagnostics containing array operators
Fixes: QTCREATORBUG-31670 Change-Id: Ib0fa824d46d3e4297a0bdcfb66aef94e6e510a54 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -105,9 +105,16 @@ FilePath currentCppEditorDocumentFilePath()
|
||||
|
||||
DiagnosticTextInfo::DiagnosticTextInfo(const QString &text)
|
||||
: m_text(text)
|
||||
, m_squareBracketStartIndex(text.lastIndexOf('['))
|
||||
{}
|
||||
|
||||
int DiagnosticTextInfo::getSquareBracketStartIndex() const
|
||||
{
|
||||
const int offset = m_text.lastIndexOf('[');
|
||||
if (offset < m_text.length() - 1 && m_text.at(offset + 1) == ']')
|
||||
return -1;
|
||||
return offset;
|
||||
}
|
||||
|
||||
QString DiagnosticTextInfo::textWithoutOption() const
|
||||
{
|
||||
if (m_squareBracketStartIndex == -1)
|
||||
|
@@ -65,8 +65,10 @@ public:
|
||||
static QString clazyCheckName(const QString &option);
|
||||
|
||||
private:
|
||||
int getSquareBracketStartIndex() const;
|
||||
|
||||
const QString m_text;
|
||||
const int m_squareBracketStartIndex;
|
||||
const int m_squareBracketStartIndex = getSquareBracketStartIndex();
|
||||
};
|
||||
|
||||
class ClangSourceRange
|
||||
|
Reference in New Issue
Block a user