summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/misc/UseOverride.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clang-tidy/misc/UseOverride.cpp')
-rw-r--r--clang-tools-extra/clang-tidy/misc/UseOverride.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/clang-tools-extra/clang-tidy/misc/UseOverride.cpp b/clang-tools-extra/clang-tidy/misc/UseOverride.cpp
index bd55f894af8..2b9ef5bc681 100644
--- a/clang-tools-extra/clang-tidy/misc/UseOverride.cpp
+++ b/clang-tools-extra/clang-tidy/misc/UseOverride.cpp
@@ -98,8 +98,10 @@ void UseOverride::check(const MatchFinder::MatchResult &Result) {
if (Method->hasAttrs()) {
for (const clang::Attr *A : Method->getAttrs()) {
if (!A->isImplicit()) {
- InsertLoc = Sources.getExpansionLoc(A->getLocation());
- break;
+ SourceLocation Loc = Sources.getExpansionLoc(A->getLocation());
+ if (!InsertLoc.isValid() ||
+ Sources.isBeforeInTranslationUnit(Loc, InsertLoc))
+ InsertLoc = Loc;
}
}
}
OpenPOWER on IntegriCloud