aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/CBackend/CBackend.cpp
diff options
context:
space:
mode:
authorGabor Greif <ggreif@gmail.com>2010-08-04 10:00:52 +0000
committerGabor Greif <ggreif@gmail.com>2010-08-04 10:00:52 +0000
commit94ab4902601bd4a5144dbdb0516c35a421cb48e2 (patch)
tree005c9da247c61bd500825ca02b9e4190add5c22b /llvm/lib/Target/CBackend/CBackend.cpp
parent6b43ea117f3594045b67d992527973a3b7b3dec1 (diff)
downloadllvm-94ab4902601bd4a5144dbdb0516c35a421cb48e2.zip
llvm-94ab4902601bd4a5144dbdb0516c35a421cb48e2.tar.gz
llvm-94ab4902601bd4a5144dbdb0516c35a421cb48e2.tar.bz2
by Alexander Herz:
"The CWriter::GetValueName() method does not check if a value as an alias and emits the alias name which will never be defined in the output .c file (so the output file fails to compile). This can happen if you have multiple inheritance with several destructors defined by clang (...D0Ev, ...D1Ev, ...D2Ev)." -- applied with minor tweaks. Thanks! llvm-svn: 110194
Diffstat (limited to 'llvm/lib/Target/CBackend/CBackend.cpp')
-rw-r--r--llvm/lib/Target/CBackend/CBackend.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Target/CBackend/CBackend.cpp b/llvm/lib/Target/CBackend/CBackend.cpp
index e8d8474..3b4d0a6 100644
--- a/llvm/lib/Target/CBackend/CBackend.cpp
+++ b/llvm/lib/Target/CBackend/CBackend.cpp
@@ -1300,6 +1300,13 @@ void CWriter::printConstantWithCast(Constant* CPV, unsigned Opcode) {
}
std::string CWriter::GetValueName(const Value *Operand) {
+
+ // Resolve potential alias.
+ if (const GlobalAlias *GA = dyn_cast<GlobalAlias>(Operand)) {
+ if (const Value *V = GA->resolveAliasedGlobal(false))
+ Operand = V;
+ }
+
// Mangle globals with the standard mangler interface for LLC compatibility.
if (const GlobalValue *GV = dyn_cast<GlobalValue>(Operand)) {
SmallString<128> Str;