[PATCH] D36407: [Sema] Extend -Wenum-compare to handle mixed enum comparisons in switch statements
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 8 08:07:23 PDT 2017
aaron.ballman added a comment.
Can you generate the updated patch with more context (https://llvm.org/docs/Phabricator.html#requesting-a-review-via-the-web-interface)?
================
Comment at: lib/Sema/SemaStmt.cpp:746
+static void checkEnumTypesInSwitchStmt(Sema &S, Expr *Cond, Expr *Case) {
+ QualType CondType = GetTypeBeforeIntegralPromotion(Cond);
----------------
`Cond` and `Case` can be declared as `const` pointers.
================
Comment at: lib/Sema/SemaStmt.cpp:758
+
+ SourceLocation Loc = Case->getExprLoc();
+ S.Diag(Loc, diag::warn_comparison_of_mixed_enum_types)
----------------
You can lower this in to the diagnostic.
https://reviews.llvm.org/D36407
More information about the cfe-commits
mailing list