summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaChecking.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2012-12-21 19:45:33 +0000
committerTed Kremenek <kremenek@apple.com>2012-12-21 19:45:33 +0000
commitb6439e6bfee2999006c01005a441b741575ff456 (patch)
treec426d948c32ccae76545eab2f0683cf9a61503c3 /clang/lib/Sema/SemaChecking.cpp
parentc1f014afc8fe634b3fb87d1b531dad996ab22359 (diff)
downloadbcm5719-llvm-b6439e6bfee2999006c01005a441b741575ff456.tar.gz
bcm5719-llvm-b6439e6bfee2999006c01005a441b741575ff456.zip
Use descriptive enum instead of raw integers for checkUnsafeAssignLiteral().
llvm-svn: 170920
Diffstat (limited to 'clang/lib/Sema/SemaChecking.cpp')
-rw-r--r--clang/lib/Sema/SemaChecking.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 8b0d579423c..c2dabb45afe 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -5753,26 +5753,28 @@ static bool checkUnsafeAssignLiteral(Sema &S, SourceLocation Loc,
// immediately zapped in a weak reference. Note that we explicitly
// allow ObjCStringLiterals, since those are designed to never really die.
RHS = RHS->IgnoreParenImpCasts();
- unsigned kind = 4;
+ // This enum needs to match with the 'select' in warn_arc_literal_assign.
+ enum Kind { Dictionary = 0, Array, Block, BoxedE, None };
+ unsigned kind = None;
switch (RHS->getStmtClass()) {
default:
break;
case Stmt::ObjCDictionaryLiteralClass:
- kind = 0;
+ kind = Dictionary;
break;
case Stmt::ObjCArrayLiteralClass:
- kind = 1;
+ kind = Array;
break;
case Stmt::BlockExprClass:
- kind = 2;
+ kind = Block;
break;
case Stmt::ObjCBoxedExprClass:
- kind = 3;
+ kind = BoxedE;
break;
}
- if (kind < 4) {
+ if (kind != None) {
S.Diag(Loc, diag::warn_arc_literal_assign)
- << kind
+ << (unsigned) kind
<< (isProperty ? 0 : 1)
<< RHS->getSourceRange();
return true;
OpenPOWER on IntegriCloud