diff options
author | Ted Kremenek <kremenek@apple.com> | 2012-12-21 22:46:35 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2012-12-21 22:46:35 +0000 |
commit | d3292c88ad6360823818b78d67875eceb3caedfb (patch) | |
tree | d36b171b159d1b6ff4ec9500a29430073a299efb /lib/Sema/SemaChecking.cpp | |
parent | 0a19ee8334aebdf73383f165e26477cd146e1178 (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/SemaChecking.cpp')
-rw-r--r-- | lib/Sema/SemaChecking.cpp | 17 |
1 files changed, 6 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(); |