[PATCH] D33568: Fix crash when evaluating constant expressions involving nullptr
Richard Smith via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu May 25 14:56:01 PDT 2017
rsmith added inline comments.
================
Comment at: clang/lib/AST/ExprConstant.cpp:5498-5500
Result.set((Expr*)nullptr, 0, false, true, Offset);
+ Result.getLValueDesignator() =
+ SubobjectDesignator(E->getType()->getPointeeType());
----------------
This is the only caller of `set()` that passes more than three arguments (that is, the only caller that passes `true` as `IsNullPtr_`). It seems that such calls would always be unsafe / wrong, so I think we can do better than this.
How about this: split `set()` into two functions: for one of them, remove the last two parameters (`IsNullPtr_` and `Offset_`), and for the other one, rename to `setNull()` and just pass a `QualType` and offset.
https://reviews.llvm.org/D33568
More information about the cfe-commits
mailing list