[PATCH] D64666: [Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss

Ziang Wan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 29 10:35:58 PDT 2019


ziangwan marked an inline comment as done.
ziangwan added inline comments.


================
Comment at: clang/lib/Sema/SemaChecking.cpp:11656
+  IsListInit =
+      IsListInit || (isa<InitListExpr>(OrigE) && S.getLangOpts().CPlusPlus);
+
----------------
aaron.ballman wrote:
> Do you want to perform the `isa<>` on `OrigE` or on `E` which has had paren and implicit casts stripped?
When we are dealing with Initialization list syntax expression, the out-most expression will be of type `InitListExpr`. Since the out-most expression is not `ImplicitCastExpr`, `IgnoreParenImpCasts()` has no effect on the `OrigE` object. In other words, `OrigE` and `E` will be the same when `isa<InitListExpr>(OrigE)` evaluates to true.

In this case, I personally prefer `OrigE` since it is the "non-processed" object. However, the rest of the function uses `E` only. I can change it to `E`.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64666/new/

https://reviews.llvm.org/D64666





More information about the cfe-commits mailing list