diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2014-11-03 19:46:18 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2014-11-03 19:46:18 +0000 |
commit | e3db7784b685e23ae92c644bdbfa1117e6c9a142 (patch) | |
tree | 88e22b3c599b31286492a8099958d4a4ffac2411 /clang/lib/Sema/SemaDeclCXX.cpp | |
parent | 005505b027d4f9f2206073660f19f081e2dc5aeb (diff) | |
download | bcm5719-llvm-e3db7784b685e23ae92c644bdbfa1117e6c9a142.tar.gz bcm5719-llvm-e3db7784b685e23ae92c644bdbfa1117e6c9a142.zip |
Further restrict issuance of 'override' warning if method
is argument to a macro which is defined in system header.
llvm-svn: 221172
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 0fae8c86d1b..c1157451966 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/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(); |