summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorGabor Horvath <xazax.hun@gmail.com>2017-08-09 12:34:58 +0000
committerGabor Horvath <xazax.hun@gmail.com>2017-08-09 12:34:58 +0000
commitb57e264257f3402c1dee3fbfe9df250952e86070 (patch)
treeaf95f2ba7aec9105a282212e284c6d8068de882b /clang/lib
parent3bfb365f52f779dcad3f0835f4bb4a5e3c39df50 (diff)
downloadbcm5719-llvm-b57e264257f3402c1dee3fbfe9df250952e86070.tar.gz
bcm5719-llvm-b57e264257f3402c1dee3fbfe9df250952e86070.zip
[Sema] -Wenum-compare no longer warn on anonymous enums in switch statements
Patch by: Reka Nikolett Kovacs llvm-svn: 310468
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaStmt.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index 6bdc71bb891..1b6aed61933 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -753,6 +753,12 @@ static void checkEnumTypesInSwitchStmt(Sema &S, const Expr *Cond,
if (!CondEnumType || !CaseEnumType)
return;
+ // Ignore anonymous enums.
+ if (!CondEnumType->getDecl()->getIdentifier())
+ return;
+ if (!CaseEnumType->getDecl()->getIdentifier())
+ return;
+
if (S.Context.hasSameUnqualifiedType(CondType, CaseType))
return;
OpenPOWER on IntegriCloud