forked from OSchip/llvm-project
Don't issue a warning if the shadowing declaration is in a class
Follow-up to r299363 "Enhance -Wshadow to warn when shadowing typedefs or type aliases". Patch by Ahmed Asadi. Differential Revision: https://reviews.llvm.org/D31235 llvm-svn: 299522
This commit is contained in:
parent
23af89cc9a
commit
be55c60d94
|
@ -6744,6 +6744,10 @@ NamedDecl *Sema::getShadowedDeclaration(const VarDecl *D,
|
|||
/// if it doesn't shadow any declaration or shadowing warnings are disabled.
|
||||
NamedDecl *Sema::getShadowedDeclaration(const TypedefNameDecl *D,
|
||||
const LookupResult &R) {
|
||||
// Don't warn if typedef declaration is part of a class
|
||||
if (D->getDeclContext()->isRecord())
|
||||
return nullptr;
|
||||
|
||||
if (!shouldWarnIfShadowedDecl(Diags, R))
|
||||
return nullptr;
|
||||
|
||||
|
|
|
@ -87,6 +87,16 @@ class A {
|
|||
}
|
||||
};
|
||||
|
||||
struct path {
|
||||
using value_type = char;
|
||||
typedef char value_type2;
|
||||
struct iterator {
|
||||
using value_type = path; // no warning
|
||||
typedef path value_type2; // no warning
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// TODO: this should warn, <rdar://problem/5018057>
|
||||
class B : A {
|
||||
int data;
|
||||
|
|
Loading…
Reference in New Issue