[PATCH] Fix IRGen for referencing a static local before emitting its decl

Reid Kleckner rnk at google.com
Tue Oct 7 17:35:32 PDT 2014


Thanks!

================
Comment at: lib/CodeGen/CGDecl.cpp:231
@@ +230,3 @@
+    GD = GlobalDecl(FD);
+  if (GD.getDecl())
+    (void)GetAddrOfGlobal(GD);
----------------
rsmith wrote:
> Should we handle `ObjCMethodDecl`s here?
I thought about this a lot and I don't think this bug is reachable with an objective C method decl. They always appear at global scope, and you can't actually refer to one without constructing an object of the ObjC class type and calling the method indirectly via string lookup. If you've done that, that implies we've emitted the code.

That overflowed my objective C thinking budget, so I avoided crashing on them and moved on. I'll try to comment on that.

http://reviews.llvm.org/D4787






More information about the cfe-commits mailing list