aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2012-12-21 22:46:35 +0000
committerTed Kremenek <kremenek@apple.com>2012-12-21 22:46:35 +0000
commitd3292c88ad6360823818b78d67875eceb3caedfb (patch)
treed36b171b159d1b6ff4ec9500a29430073a299efb /lib/Sema/SemaExpr.cpp
parent0a19ee8334aebdf73383f165e26477cd146e1178 (diff)
Tweak Sema::CheckLiteralKind() to also include block literals
This simplifies some diagnostic logic in checkUnsafeAssignLiteral(), hopefully making it less error prone. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170945 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r--lib/Sema/SemaExpr.cpp3
1 files changed, 3 insertions, 0 deletions
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");
}