summaryrefslogtreecommitdiff
path: root/lib
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
commitac27ec0f5b592a5e8a11646dab6bcd8921685208 (patch)
tree7f04af5e82ed55445435bed01337944ea7b83f62 /lib
parent484959a26c097968e9b331b5063cda788ae1e034 (diff)
downloadllvm-ac27ec0f5b592a5e8a11646dab6bcd8921685208.tar.gz
llvm-ac27ec0f5b592a5e8a11646dab6bcd8921685208.tar.bz2
llvm-ac27ec0f5b592a5e8a11646dab6bcd8921685208.tar.xz
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! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110194 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/CBackend/CBackend.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp
index e8d8474b5b..3b4d0a604c 100644
--- a/lib/Target/CBackend/CBackend.cpp
+++ b/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;