andreybokhanko added inline comments.

================
Comment at: lib/CodeGen/CodeGenModule.cpp:1235-1236
@@ -1235,8 +1234,4 @@
     // different type.
-    // FIXME: Support for variables is not implemented yet.
-    if (isa<FunctionDecl>(D.getDecl()))
-      GV = cast<llvm::GlobalValue>(GetAddrOfGlobal(D, 
/*IsForDefinition=*/true));
-    else
-      if (!GV)
-        GV = GetGlobalValue(getMangledName(D));
+    llvm::GlobalValue *GV =
+        cast<llvm::GlobalValue>(GetAddrOfGlobal(D, /*IsForDefinition=*/true));
 
----------------
Artem, to address your concern (from http://reviews.llvm.org/rL254195#39417): 
if IsForDefinition equals to true, it is guaranteed that we get GlobalValue 
here. We specifically call GetAddrOfGlobal to create (or get) a global with 
required type, not cast from a declaration with a different type.


http://reviews.llvm.org/D15686



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to