aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-02-21 19:44:02 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-02-21 19:44:02 +0000
commit7b5b3170d9be39f462194d456051a7ca81babe28 (patch)
treecd36342b25bac9f73422f89cb1e139774b9ae0f2 /lib/Sema/SemaDecl.cpp
parent4ae1f058902ffd92207af678e1c62e43258127c6 (diff)
Warn on use of __weak attribute on local
variable (objc2 gc specific). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65240 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r--lib/Sema/SemaDecl.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 51c479040b..3130f02bef 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -1592,6 +1592,11 @@ Sema::ActOnVariableDeclarator(Scope* S, Declarator& D, DeclContext* DC,
Diag(D.getIdentifierLoc(), diag::err_as_qualified_auto_decl);
InvalidDecl = true;
}
+
+ if (NewVD->hasLocalStorage() && NewVD->getType().isObjCGCWeak()) {
+ Diag(D.getIdentifierLoc(), diag::warn_attribute_weak_on_local);
+ }
+
// Merge the decl with the existing one if appropriate. If the decl is
// in an outer scope, it isn't the same thing.
if (PrevDecl && isDeclInScope(PrevDecl, DC, S)) {