[PATCH] D71491: [ubsan] Check implicit casts in ObjC for-in statements

Vedant Kumar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 13 14:15:06 PST 2019


vsk created this revision.
vsk added reviewers: rjmccall, jfb, arphaman, delcypher.
Herald added subscribers: llvm-commits, dexonsmith.
Herald added a project: LLVM.

Check that the implicit cast from `id` used to construct the element
variable in an ObjC for-in statement is valid.

This check is included as part of a new `objc-cast` sanitizer, outside
of the main 'undefined' group, as (IIUC) the behavior it's checking for
is not technically UB.

The check can be extended to cover other kinds of invalid casts in ObjC.

Partially addresses: rdar://12903059, rdar://9542496


https://reviews.llvm.org/D71491

Files:
  clang/docs/UndefinedBehaviorSanitizer.rst
  clang/include/clang/Basic/Sanitizers.def
  clang/lib/CodeGen/CGObjC.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/Driver/SanitizerArgs.cpp
  clang/lib/Driver/ToolChain.cpp
  clang/test/CodeGenObjC/for-in.m
  compiler-rt/lib/ubsan/ubsan_checks.inc
  compiler-rt/lib/ubsan/ubsan_handlers.cpp
  compiler-rt/lib/ubsan/ubsan_handlers.h
  compiler-rt/lib/ubsan/ubsan_value.cpp
  compiler-rt/lib/ubsan/ubsan_value.h
  compiler-rt/test/ubsan/TestCases/Misc/objc-cast.m

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71491.233881.patch
Type: text/x-patch
Size: 15411 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191213/0170cb3a/attachment-0001.bin>


More information about the cfe-commits mailing list