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:
Fariborz Jahanian 2014-10-31 19:56:27 +00:00
parent 40aa4a26d1
commit 6e21338abb
3 changed files with 26 additions and 0 deletions

View File

@ -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();

View File

@ -0,0 +1,3 @@
// override-system-header.h to test out 'override' warning.
// rdar://18295240
#define END_COM_MAP virtual unsigned AddRef(void) = 0;

View File

@ -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;
};