[PATCH] D50467: [SEMA] add more -Wfloat-conversion to compound assigment analysis
Nick Desaulniers via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 8 15:51:29 PDT 2018
nickdesaulniers added inline comments.
================
Comment at: lib/Sema/SemaChecking.cpp:10411
+ ->getAs<BuiltinType>();
+ if (!ResultBT || !(RBT && RBT->isFloatingPoint())) return;
+
----------------
nickdesaulniers wrote:
> pirama wrote:
> > Add a comment explaining this conditional as well?
> >
> > > Return if source and target types are unavailable or if source is not a floating point.
> >
> > With the comment, it might be cleaner to read if you expand the negation: `!ResultBT || !RBT || !RBT->isFloatingPoint()`
> `ResultBT` and `RBT` are pointers that may be null and need to be checked. The previous code did this before accessing them, I've just moved the checks to be sooner.
>
> If `!RBT` (if it's `nullptr`), then `!RBT->isFloatingPoint()` would be a null deref, so unfortunately I can not expand it as recommended.
oops, nevermind
Repository:
rC Clang
https://reviews.llvm.org/D50467
More information about the cfe-commits
mailing list