aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Sema/SemaChecking.cpp17
-rw-r--r--lib/Sema/SemaExpr.cpp3
2 files changed, 9 insertions, 11 deletions
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp
index 7d957ec408..f0de7becb2 100644
--- a/lib/Sema/SemaChecking.cpp
+++ b/lib/Sema/SemaChecking.cpp
@@ -5754,19 +5754,14 @@ static bool checkUnsafeAssignLiteral(Sema &S, SourceLocation Loc,
// allow ObjCStringLiterals, since those are designed to never really die.
RHS = RHS->IgnoreParenImpCasts();
- // Classification for diagnostic.
- unsigned SelectVal = /* block literal */ 0;
- if (!isa<BlockExpr>(RHS)) {
- // This enum needs to match with the 'select' in
- // warn_objc_arc_literal_assign (off-by-1).
- Sema::ObjCLiteralKind Kind = S.CheckLiteralKind(RHS);
- if (Kind == Sema::LK_String || Kind == Sema::LK_None)
- return false;
- SelectVal = (unsigned) Kind + 1;
- }
+ // This enum needs to match with the 'select' in
+ // warn_objc_arc_literal_assign (off-by-1).
+ Sema::ObjCLiteralKind Kind = S.CheckLiteralKind(RHS);
+ if (Kind == Sema::LK_String || Kind == Sema::LK_None)
+ return false;
S.Diag(Loc, diag::warn_arc_literal_assign)
- << SelectVal
+ << (unsigned) Kind
<< (isProperty ? 0 : 1)
<< RHS->getSourceRange();
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 0ea3b6cc39..191a26d105 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -6874,6 +6874,8 @@ Sema::ObjCLiteralKind Sema::CheckLiteralKind(Expr *FromE) {
case Stmt::ObjCDictionaryLiteralClass:
// "dictionary literal"
return LK_Dictionary;
+ case Stmt::BlockExprClass:
+ return LK_Block;
case Stmt::ObjCBoxedExprClass: {
Expr *Inner = cast<ObjCBoxedExpr>(FromE)->getSubExpr()->IgnoreParens();
switch (Inner->getStmtClass()) {
@@ -6923,6 +6925,7 @@ static void diagnoseObjCLiteralComparison(Sema &S, SourceLocation Loc,
// LK_String should always be after the other literals, since it has its own
// warning flag.
Sema::ObjCLiteralKind LiteralKind = S.CheckLiteralKind(Literal);
+ assert(LiteralKind != Sema::LK_Block);
if (LiteralKind == Sema::LK_None) {
llvm_unreachable("Unknown Objective-C object literal kind");
}