diff options
Diffstat (limited to 'clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.cpp')
| -rw-r--r-- | clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.cpp index f6202c7279b..9429eb2cbf7 100644 --- a/clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.cpp @@ -38,11 +38,16 @@ ParseTokens(CharSourceRange Range, const MatchFinder::MatchResult &Result) { File.end()); SmallVector<Token, 16> Tokens; Token Tok; + int NestedParens = 0; while (!RawLexer.LexFromRawLexer(Tok)) { - if (Tok.is(tok::semi) || Tok.is(tok::l_brace)) + if ((Tok.is(tok::semi) || Tok.is(tok::l_brace)) && NestedParens == 0) break; if (Sources.isBeforeInTranslationUnit(Range.getEnd(), Tok.getLocation())) break; + if (Tok.is(tok::l_paren)) + ++NestedParens; + else if (Tok.is(tok::r_paren)) + --NestedParens; if (Tok.is(tok::raw_identifier)) { IdentifierInfo &Info = Result.Context->Idents.get(StringRef( Sources.getCharacterData(Tok.getLocation()), Tok.getLength())); |

