aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2012-12-20 22:31:27 +0000
committerTed Kremenek <kremenek@apple.com>2012-12-20 22:31:27 +0000
commit904a326e6297ad75aab353c1957fb874b36260c9 (patch)
treed081dc2009b4bdcc15276e15a006b5a1cb5f7ab7 /lib/Sema/SemaDecl.cpp
parent5964df144c21c548b9963f2ca35e0fa852b2f6f7 (diff)
Revert "Warn if a __weak variable is initialized with an Objective-C object literal."
Per code feedback, I want to see if there is a more general way to do this. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170777 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r--lib/Sema/SemaDecl.cpp19
1 files changed, 1 insertions, 18 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 9ca7782164..96e911d17b 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -6780,30 +6780,13 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init,
// we do not warn to warn spuriously when 'x' and 'y' are on separate
// paths through the function. This should be revisited if
// -Wrepeated-use-of-weak is made flow-sensitive.
- Qualifiers::ObjCLifetime Lifetime = VDecl->getType().getObjCLifetime();
- if (Lifetime == Qualifiers::OCL_Strong) {
+ if (VDecl->getType().getObjCLifetime() == Qualifiers::OCL_Strong) {
DiagnosticsEngine::Level Level =
Diags.getDiagnosticLevel(diag::warn_arc_repeated_use_of_weak,
Init->getLocStart());
if (Level != DiagnosticsEngine::Ignored)
getCurFunction()->markSafeWeakUse(Init);
}
- else if (Lifetime == Qualifiers::OCL_Weak) {
- // Check if we are initializing a __weak variable with an Objective-C
- // object literal. Since there is no other strong reference, the
- // __weak variable may immediately become nil.
- Expr *InitSansParen = Init->IgnoreParenImpCasts();
- switch (InitSansParen->getStmtClass()) {
- default: break;
- case Stmt::BlockExprClass:
- case Stmt::ObjCArrayLiteralClass:
- case Stmt::ObjCDictionaryLiteralClass:
- case Stmt::ObjCStringLiteralClass:
- Diag(VDecl->getLocation(), diag::warn_attribute_weak_objc_literal)
- << Init->getSourceRange();
- break;
- }
- }
}
Init = MaybeCreateExprWithCleanups(Init);