[PATCH] D42561: [PR36008] Avoid -Wsign-compare warning for enum constants in typeof expressions

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 26 02:37:19 PST 2018


lebedev.ri added inline comments.


================
Comment at: lib/Sema/SemaChecking.cpp:8959
+  if (!S.getLangOpts().CPlusPlus) {
+    if (const TypeOfExprType *TET = dyn_cast<TypeOfExprType>(RHS->getType()))
+      RHS = TET->getUnderlyingExpr()->IgnoreParenImpCasts();
----------------
Please also add a comment what this is trying to solve.


================
Comment at: test/Sema/compare.c:404
+  __typeof__(kPR36008Value) y = (kPR36008Value);
+  if (x == y) x = y; // no warning
+}
----------------
Can you also add the swapped test:
```
if (y == x) x = y; // no warning
```


Repository:
  rC Clang

https://reviews.llvm.org/D42561





More information about the cfe-commits mailing list