diff options
author | Ted Kremenek <kremenek@apple.com> | 2012-12-21 19:45:33 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2012-12-21 19:45:33 +0000 |
commit | e63a603c797b1a83c844923fb17dc31b4d96a031 (patch) | |
tree | a230b4997774a7d3f193025df8f3ec36053a470e /lib/Sema/SemaChecking.cpp | |
parent | b29b30f9631937916786dc2e06c2842acf9c1500 (diff) |
Use descriptive enum instead of raw integers for checkUnsafeAssignLiteral().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170920 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaChecking.cpp')
-rw-r--r-- | lib/Sema/SemaChecking.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index 8b0d579423..c2dabb45af 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/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; |