[PATCH] D57668: [opaque pointer types] Pass function types for runtime function calls.

James Y Knight via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 4 18:45:47 PST 2019


jyknight marked an inline comment as done.
jyknight added inline comments.


================
Comment at: clang/lib/CodeGen/CGObjC.cpp:1028-1030
+    llvm::Constant *getPropertyFn = cast<llvm::Constant>(
+        CGM.getObjCRuntime().GetPropertyGetFunction().getCallee());
     if (!getPropertyFn) {
----------------
dblaikie wrote:
> This code looks like it implies that the 'if' is never hit? (since cast doesn't propagate null (it asserts/fails/UB on null)) - should this be cast_or_null instead? Or "if(!CGM.getObjCRuntime().getPropertyGetFunction())" ?)
> 
> (there are a few similar instances later on)
Indeed, good catch! I don't know if that actually happens, but this code also didn't even need these casts.

Removed the casts, both simplifying the code, and fixing that potential issue.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57668/new/

https://reviews.llvm.org/D57668





More information about the cfe-commits mailing list