andreybokhanko added inline comments. ================ Comment at: lib/CodeGen/CodeGenModule.cpp:1235-1243 @@ -1235,9 +1234,11 @@ // 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::Constant *GVC = GetAddrOfGlobal(D, /*IsForDefinition=*/true); + llvm::GlobalValue *GV = dyn_cast<llvm::GlobalValue>(GVC); + + // In case of different address spaces, we may still get a cast, even with + // IsForDefinition equal to true. Query mangled names table to get + // GlobalValue. + if (!GV) + GV = GetGlobalValue(getMangledName(D)); // Check to see if we've already emitted this. This is necessary ---------------- You are right -- I missed this case. Fixed.
Patch updated. http://reviews.llvm.org/D15686 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits