Skip to content

Commit 11b5f8e

Browse files
committed
fixup! [clang-tidy] Added check to detect redundant inline keyword
Do not look for inline token in macro
1 parent 40ff8cd commit 11b5f8e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

clang-tools-extra/clang-tidy/readability/RedundantInlineSpecifierCheck.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,12 @@ AST_POLYMORPHIC_MATCHER(isInlineSpecified,
3737
static std::optional<SourceLocation>
3838
getInlineTokenLocation(SourceRange RangeLocation, const SourceManager &Sources,
3939
const LangOptions &LangOpts) {
40+
SourceLocation Loc = RangeLocation.getBegin();
41+
if (Loc.isMacroID())
42+
return std::nullopt;
43+
4044
Token FirstToken;
41-
Lexer::getRawToken(RangeLocation.getBegin(), FirstToken, Sources, LangOpts,
42-
true);
45+
Lexer::getRawToken(Loc, FirstToken, Sources, LangOpts, true);
4346
std::optional<Token> CurrentToken = FirstToken;
4447
while (CurrentToken && CurrentToken->getLocation() < RangeLocation.getEnd() &&
4548
CurrentToken->isNot(tok::eof)) {

0 commit comments

Comments
 (0)