forked from OSchip/llvm-project
C++-11 [qoi]. Do not warn on missing 'verride' on use of
macros in user code when macros themselves are defined in a system header. rdar://18295240 llvm-svn: 220992
This commit is contained in:
parent
40aa4a26d1
commit
6e21338abb
|
@ -1905,6 +1905,12 @@ void Sema::DiagnoseAbsenceOfOverrideControl(NamedDecl *D) {
|
|||
isa<CXXDestructorDecl>(MD))
|
||||
return;
|
||||
|
||||
if (MD->getLocation().isMacroID()) {
|
||||
SourceLocation MacroLoc = getSourceManager().getSpellingLoc(MD->getLocation());
|
||||
if (getSourceManager().isInSystemHeader(MacroLoc))
|
||||
return;
|
||||
}
|
||||
|
||||
if (MD->size_overridden_methods() > 0) {
|
||||
Diag(MD->getLocation(), diag::warn_function_marked_not_override_overriding)
|
||||
<< MD->getDeclName();
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
// override-system-header.h to test out 'override' warning.
|
||||
// rdar://18295240
|
||||
#define END_COM_MAP virtual unsigned AddRef(void) = 0;
|
|
@ -0,0 +1,17 @@
|
|||
// RUN: %clang_cc1 -std=c++11 -isystem %S/Inputs %s -verify
|
||||
// expected-no-diagnostics
|
||||
// rdar://18295240
|
||||
|
||||
#include <override-system-header.h>
|
||||
|
||||
struct A
|
||||
{
|
||||
virtual void x();
|
||||
END_COM_MAP;
|
||||
};
|
||||
|
||||
struct B : A
|
||||
{
|
||||
virtual void x() override;
|
||||
END_COM_MAP;
|
||||
};
|
Loading…
Reference in New Issue