[llvm-commits] [llvm] r110194 - /llvm/trunk/lib/Target/CBackend/CBackend.cpp

Gabor Greif ggreif at gmail.com
Wed Aug 4 03:00:52 PDT 2010


Author: ggreif
Date: Wed Aug  4 05:00:52 2010
New Revision: 110194

URL: http://llvm.org/viewvc/llvm-project?rev=110194&view=rev
Log:
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!

Modified:
    llvm/trunk/lib/Target/CBackend/CBackend.cpp

Modified: llvm/trunk/lib/Target/CBackend/CBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CBackend/CBackend.cpp?rev=110194&r1=110193&r2=110194&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CBackend/CBackend.cpp (original)
+++ llvm/trunk/lib/Target/CBackend/CBackend.cpp Wed Aug  4 05:00:52 2010
@@ -1300,6 +1300,13 @@
 }
 
 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;





More information about the llvm-commits mailing list