[PATCH] D52344: [Clang][CodeGen][ObjC]: Fix non-bridged CoreFoundation builds on ELF targets that use `-fconstant-cfstrings`.

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 21 12:24:01 PDT 2018


rjmccall added inline comments.


================
Comment at: lib/CodeGen/CodeGenModule.cpp:4108
+      // consistent with old behavior for this target as it would fail
+      // on the cast<> instead.
+      assert(GV && "isa<CFConstantStringClassReference> isn't a GlobalValue");
----------------
compnerd wrote:
> I think that the comment isn't particularly helpful - it basically is directing you to look at the history of the file.
I think we should just skip this step, even on COFF, if it's not a `GlobalValue`.

Probably the most correct move would be to only apply this logic if the IR declaration was synthesized.  Or maybe even just change this code to look for a global variable called `__CFConstantStringClassReference` in the first place and then emit a reference to it if found, and only otherwise try to build the synthetic variable.  But just bailing out early if something weird is going on is also a legitimate step.


Repository:
  rC Clang

https://reviews.llvm.org/D52344





More information about the cfe-commits mailing list