forked from qt-creator/qt-creator
clangbackend: Add another exception to our "find real cursor" heuristic
Leave preprocessor directives alone. Fixes: QTCREATORBUG-25692 Change-Id: I1c31f4120e9b86a58123f8877cebd354e800fb8b Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -380,7 +380,9 @@ void TokenInfo::identifierKind(const Cursor &cursor, Recursion recursion)
|
||||
if (cursor.isInvalidDeclaration())
|
||||
return;
|
||||
|
||||
if (recursion == Recursion::FirstPass && cursor.kind() != CXCursor_NotImplemented) {
|
||||
if (recursion == Recursion::FirstPass
|
||||
&& cursor.kind() != CXCursor_NotImplemented
|
||||
&& cursor.kind() != CXCursor_PreprocessingDirective) {
|
||||
const Cursor c = realCursor(cursor);
|
||||
if (!clang_isInvalid(c.kind()) && c != cursor) {
|
||||
identifierKind(c, Recursion::FirstPass);
|
||||
|
@@ -788,3 +788,7 @@ static inline constexpr vecn<T, S> operator<(vecn<T, S> a, vecn<T, S> b)
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
struct foo {
|
||||
#define blubb
|
||||
};
|
||||
|
@@ -1807,6 +1807,12 @@ TEST_F(TokenProcessor, OperatorInTemplate)
|
||||
ASSERT_THAT(infos[9], HasOnlyType(HighlightingType::Punctuation));
|
||||
}
|
||||
|
||||
TEST_F(TokenProcessor, PreProcessorInStruct)
|
||||
{
|
||||
const auto infos = translationUnit.tokenInfosInRange(sourceRange(793, 14));
|
||||
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Preprocessor));
|
||||
}
|
||||
|
||||
Data *TokenProcessor::d;
|
||||
|
||||
void TokenProcessor::SetUpTestCase()
|
||||
|
Reference in New Issue
Block a user