aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-03-17 16:03:44 +0000
committerDouglas Gregor <dgregor@apple.com>2010-03-17 16:03:44 +0000
commitc48c916b8cebba954429715f15bd5b5e8e4d4574 (patch)
tree5b0a7e531f8b5cefc3018595d4c216f620c70cf2
parentdbf8ee630e4c86e5150492eaf8dbceea3c718ee1 (diff)
Remove warning about shadowing a built-in; built-ins aren't actually
considered to be a part of the translation unit unless they're named in a way that brings them into existence. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98729 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Basic/DiagnosticSemaKinds.td3
-rw-r--r--lib/Sema/SemaDecl.cpp10
-rw-r--r--test/Sema/warn-shadow.c2
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.
}