diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-02-21 19:44:02 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-02-21 19:44:02 +0000 |
commit | 7b5b3170d9be39f462194d456051a7ca81babe28 (patch) | |
tree | cd36342b25bac9f73422f89cb1e139774b9ae0f2 /lib/Sema/SemaDecl.cpp | |
parent | 4ae1f058902ffd92207af678e1c62e43258127c6 (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.cpp | 5 |
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)) { |