diff options
-rw-r--r-- | include/clang/Basic/DiagnosticSemaKinds.td | 3 | ||||
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 10 | ||||
-rw-r--r-- | test/Sema/warn-shadow.c | 2 |
3 files changed, 3 insertions, 12 deletions
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index b2b4306bfa..6e19051ce3 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -113,8 +113,7 @@ def warn_decl_shadow : "local variable|" "variable in %2|" "static data member of %2|" - "field of %2|" - "global built-in function}1">, + "field of %2}1">, InGroup<Shadow>, DefaultIgnore; // C++ using declarations diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index f4b9cf4cde..d562a52694 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -2482,16 +2482,8 @@ void Sema::DiagnoseShadow(NamedDecl* D, const LookupResult& R) { DeclarationName Name = D->getDeclName(); // Return if lookup has no result. - if (R.getResultKind() != LookupResult::Found) { - // Emit warning for built-in shadowing. - if (Name.getAsIdentifierInfo() && - Name.getAsIdentifierInfo()->getBuiltinID()) - Diag(D->getLocation(), diag::warn_decl_shadow) - << Name - << 4 // global builtin - << Context.getTranslationUnitDecl(); + if (R.getResultKind() != LookupResult::Found) return; - } // Return if not variable decl. NamedDecl* ShadowedDecl = R.getFoundDecl(); diff --git a/test/Sema/warn-shadow.c b/test/Sema/warn-shadow.c index f75c140be1..dacf66d592 100644 --- a/test/Sema/warn-shadow.c +++ b/test/Sema/warn-shadow.c @@ -16,5 +16,5 @@ void foo() { } } - int __sync_fetch_and_add; // expected-warning {{declaration shadows a global built-in function}} + int sin; // okay; 'sin' has not been declared, even though it's a builtin. } |