diff options
author | Richard Trieu <rtrieu@google.com> | 2017-09-09 00:25:05 +0000 |
---|---|---|
committer | Richard Trieu <rtrieu@google.com> | 2017-09-09 00:25:05 +0000 |
commit | 74973037ebfc7d071c32e4dcfde822c411274a44 (patch) | |
tree | 21c8b45273635537436efe25e60424468baa7841 /lib/Sema/SemaStmt.cpp | |
parent | 5c4cc68ec0bab7873a32528a91d866f748fe9d9b (diff) | |
download | clang-74973037ebfc7d071c32e4dcfde822c411274a44.tar.gz |
Catch more cases with -Wenum-compare
Treat typedef enum as named enums instead of anonymous enums. Anonymous enums
are ignored by the warning, so previously, typedef enums were ignored as well.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@312842 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaStmt.cpp')
-rw-r--r-- | lib/Sema/SemaStmt.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index 2e1ea3e2f6..3a3eb5e7b5 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -754,9 +754,11 @@ static void checkEnumTypesInSwitchStmt(Sema &S, const Expr *Cond, return; // Ignore anonymous enums. - if (!CondEnumType->getDecl()->getIdentifier()) + if (!CondEnumType->getDecl()->getIdentifier() && + !CondEnumType->getDecl()->getTypedefNameForAnonDecl()) return; - if (!CaseEnumType->getDecl()->getIdentifier()) + if (!CaseEnumType->getDecl()->getIdentifier() && + !CaseEnumType->getDecl()->getTypedefNameForAnonDecl()) return; if (S.Context.hasSameUnqualifiedType(CondType, CaseType)) |