summaryrefslogtreecommitdiffstats
path: root/clang/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
commit9453721985364c5b892cb81b79cdf88a4cd8315a (patch)
treee6a062884ed3128dee93d8e465895a10855062dd /clang/lib/Sema/SemaDecl.cpp
parentfd706f7da9e6290a23e2935e36d81040cc0b957d (diff)
downloadbcm5719-llvm-9453721985364c5b892cb81b79cdf88a4cd8315a.tar.gz
bcm5719-llvm-9453721985364c5b892cb81b79cdf88a4cd8315a.zip
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. llvm-svn: 170777
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp19
1 files changed, 1 insertions, 18 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 9ca77821645..96e911d17bc 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/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);
OpenPOWER on IntegriCloud