This revision was automatically updated to reflect the committed changes.
Closed by commit rL324514: [PR36008] Avoid -Wsign-compare warning for enum
constants in (authored by arphaman, committed by ).
Herald added a subscriber: llvm-commits.
Changed prior to commit:
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.
LGTM, aside from a minor commenting nit.
Comment at: lib/Sema/SemaChecking.cpp:8960
+// Avoid warning about comparison of integers with different signs
arphaman updated this revision to Diff 132901.
arphaman marked 4 inline comments as done.
arphaman added a comment.
Herald added a subscriber: jkorous-apple.
Address review comments and fix the inverted check case.
https://reviews.llvm.org/D42561
Files:
lib/Sema/SemaChecking.cpp
aaron.ballman added inline comments.
Comment at: lib/Sema/SemaChecking.cpp:8959
+ if (!S.getLangOpts().CPlusPlus) {
+if (const TypeOfExprType *TET = dyn_cast(RHS->getType()))
+ RHS = TET->getUnderlyingExpr()->IgnoreParenImpCasts();
lebedev.ri wrote:
>
lebedev.ri added inline comments.
Comment at: lib/Sema/SemaChecking.cpp:8959
+ if (!S.getLangOpts().CPlusPlus) {
+if (const TypeOfExprType *TET = dyn_cast(RHS->getType()))
+ RHS = TET->getUnderlyingExpr()->IgnoreParenImpCasts();
Please also add a
arphaman created this revision.
arphaman added a reviewer: lebedev.ri.
This patch looks through typeof type at the original expression when diagnosing
-Wsign-compare to avoid an unfriendly diagnostic.
Repository:
rC Clang
https://reviews.llvm.org/D42561
Files:
lib/Sema/SemaChecking.cpp