[PATCH] D30599: [ubsan] Extend the nonnull argument check to ObjC
Vedant Kumar via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 3 19:59:47 PST 2017
vsk created this revision.
UBSan's nonnull argument check applies when a parameter has the
"nonnull" attribute. The check currently works for FunctionDecls, but
not for ObjCMethodDecls. This patch extends the check to work for ObjC.
To do this, I introduced a new AbstractCallee class to represent the
logical callee in a generic "call", and added a use of AbstractCallee to
CGObjC.cpp. This does not affect IRGen except to fix the UBSan check.
I opted not to reuse CGCalleeInfo for this because: 1) it isn't meant to
represent the callee itself, 2) it carries around an extra pointer for
the callee prototype, and 3) it's a bit tricky to repurpose (i.e it
really "wants" to live in CGCall.h).
Testing: check-clang, check-ubsan
https://reviews.llvm.org/D30599
Files:
lib/CodeGen/CGCall.cpp
lib/CodeGen/CGExprCXX.cpp
lib/CodeGen/CGObjC.cpp
lib/CodeGen/CodeGenFunction.h
test/CodeGenObjC/ubsan-nonnull.m
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30599.90564.patch
Type: text/x-patch
Size: 8578 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170304/d2997c21/attachment.bin>
More information about the cfe-commits
mailing list