summaryrefslogtreecommitdiffstats
path: root/lib/Sema/SemaDeclCXX.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2014-11-03 19:46:18 +0000
committerFariborz Jahanian <fjahanian@apple.com>2014-11-03 19:46:18 +0000
commit4f98f2cb1544199a0fcd9ad5bbc79bf87b27d912 (patch)
treefa54caf5cd023a02bb1de1f1e23dddfc53ddfcdb /lib/Sema/SemaDeclCXX.cpp
parenteb46a586b65e7c054eb8cd1909a910439a75d174 (diff)
Further restrict issuance of 'override' warning if method
is argument to a macro which is defined in system header. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221172 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclCXX.cpp')
-rw-r--r--lib/Sema/SemaDeclCXX.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index 0fae8c86d1..c115745196 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -1905,12 +1905,14 @@ void Sema::DiagnoseAbsenceOfOverrideControl(NamedDecl *D) {
isa<CXXDestructorDecl>(MD))
return;
- if (MD->getLocation().isMacroID()) {
- SourceLocation MacroLoc = getSourceManager().getSpellingLoc(MD->getLocation());
- if (getSourceManager().isInSystemHeader(MacroLoc))
+ SourceLocation Loc = MD->getLocation();
+ SourceLocation SpellingLoc = Loc;
+ if (getSourceManager().isMacroArgExpansion(Loc))
+ SpellingLoc = getSourceManager().getImmediateExpansionRange(Loc).first;
+ SpellingLoc = getSourceManager().getSpellingLoc(SpellingLoc);
+ if (SpellingLoc.isValid() && getSourceManager().isInSystemHeader(SpellingLoc))
return;
- }
-
+
if (MD->size_overridden_methods() > 0) {
Diag(MD->getLocation(), diag::warn_function_marked_not_override_overriding)
<< MD->getDeclName();