[llvm-commits] [llvm] r92533 - in /llvm/trunk: lib/CodeGen/AsmPrinter/DwarfDebug.cpp test/FrontendC/2010-01-05-LinkageName.c
Devang Patel
dpatel at apple.com
Mon Jan 4 15:04:37 PST 2010
Author: dpatel
Date: Mon Jan 4 17:04:36 2010
New Revision: 92533
URL: http://llvm.org/viewvc/llvm-project?rev=92533&view=rev
Log:
Fix debug_inlined section entries for routines whose names are changed through __asm() extension.
Added:
llvm/trunk/test/FrontendC/2010-01-05-LinkageName.c
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=92533&r1=92532&r2=92533&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Jan 4 17:04:36 2010
@@ -1393,7 +1393,16 @@
I->second.push_back(std::make_pair(StartID, ScopeDIE));
StringPool.insert(InlinedSP.getName());
- StringPool.insert(InlinedSP.getLinkageName());
+ StringRef LinkageName = InlinedSP.getLinkageName();
+ if (!LinkageName.empty()) {
+ // Skip special LLVM prefix that is used to inform the asm printer to not
+ // emit usual symbol prefix before the symbol name. This happens for
+ // Objective-C symbol names and symbol whose name is replaced using GCC's
+ // __asm__ attribute.
+ if (LinkageName[0] == 1)
+ LinkageName = LinkageName.substr(1);
+ }
+ StringPool.insert(LinkageName);
DILocation DL(Scope->getInlinedAt());
addUInt(ScopeDIE, dwarf::DW_AT_call_file, 0, ModuleCU->getID());
addUInt(ScopeDIE, dwarf::DW_AT_call_line, 0, DL.getLineNumber());
@@ -2918,8 +2927,6 @@
for (SmallVector<MDNode *, 4>::iterator I = InlinedSPNodes.begin(),
E = InlinedSPNodes.end(); I != E; ++I) {
-// for (ValueMap<MDNode *, SmallVector<InlineInfoLabels, 4> >::iterator
- // I = InlineInfo.begin(), E = InlineInfo.end(); I != E; ++I) {
MDNode *Node = *I;
ValueMap<MDNode *, SmallVector<InlineInfoLabels, 4> >::iterator II
= InlineInfo.find(Node);
@@ -2937,13 +2944,11 @@
// __asm__ attribute.
if (LName[0] == 1)
LName = LName.substr(1);
-// Asm->EmitString(LName);
EmitSectionOffset("string", "section_str",
StringPool.idFor(LName), false, true);
}
Asm->EOL("MIPS linkage name");
-// Asm->EmitString(Name);
EmitSectionOffset("string", "section_str",
StringPool.idFor(Name), false, true);
Asm->EOL("Function name");
Added: llvm/trunk/test/FrontendC/2010-01-05-LinkageName.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC/2010-01-05-LinkageName.c?rev=92533&view=auto
==============================================================================
--- llvm/trunk/test/FrontendC/2010-01-05-LinkageName.c (added)
+++ llvm/trunk/test/FrontendC/2010-01-05-LinkageName.c Mon Jan 4 17:04:36 2010
@@ -0,0 +1,15 @@
+// RUN: %llvmgcc -O2 -S -g %s -o - | llc -o 2010-01-05-LinkageName.s -O0
+// RUN: %compile_c 2010-01-05-LinkageName.s -o 2010-01-05-LinkageName.s
+
+struct tm {};
+long mktime(struct tm *) __asm("_mktime$UNIX2003");
+tzload(name, sp, doextend){}
+long mktime(tmp)
+ struct tm *const tmp;
+{
+ tzset();
+}
+timelocal(tmp) {
+ return mktime(tmp);
+}
+
More information about the llvm-commits
mailing list