[PATCH] D15686: PR25910: clang allows two var definitions with the same mangled name
Andrey Bokhanko via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 21 05:14:07 PST 2015
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
More information about the cfe-commits
mailing list