[PATCH] D34299: [ubsan] Improve diagnostics for return value checks (clang)
Vedant Kumar via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 22 14:23:37 PDT 2017
vsk added inline comments.
================
Comment at: lib/CodeGen/CGStmt.cpp:1035
+ assert(ReturnLocation.isValid() && "No valid return location");
+ Builder.CreateStore(Builder.CreateBitCast(SLocPtr, Int8PtrTy),
+ ReturnLocation);
----------------
filcab wrote:
> Can't you just keep the `Constant*` around and use it later for the static data? Instead of creating a global var and have runtime store/load?
I hope I've cleared this up, but: we need to store the source location constant _somewhere_, before we emit the return value check. That's because we can't infer which return location to use at compile time.
================
Comment at: lib/CodeGen/CodeGenFunction.h:1412
+ /// source location for diagnostics.
+ Address ReturnLocation = Address::invalid();
+
----------------
filcab wrote:
> Maybe `CurrentReturnLocation`?
I'd prefer to keep it the way it is, for consistency with the "ReturnValue" field.
https://reviews.llvm.org/D34299
More information about the cfe-commits
mailing list