[llvm-commits] [llvm] r79289 - in /llvm/trunk: lib/VMCore/Mangler.cpp test/FrontendObjC/2009-08-17-DebugInfo.m

Devang Patel dpatel at apple.com
Mon Aug 17 16:17:17 PDT 2009


Author: dpatel
Date: Mon Aug 17 18:17:17 2009
New Revision: 79289

URL: http://llvm.org/viewvc/llvm-project?rev=79289&view=rev
Log:
Add prefix only if it is needed.

Added:
    llvm/trunk/test/FrontendObjC/2009-08-17-DebugInfo.m
Modified:
    llvm/trunk/lib/VMCore/Mangler.cpp

Modified: llvm/trunk/lib/VMCore/Mangler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Mangler.cpp?rev=79289&r1=79288&r2=79289&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/Mangler.cpp (original)
+++ llvm/trunk/lib/VMCore/Mangler.cpp Mon Aug 17 18:17:17 2009
@@ -105,8 +105,9 @@
 
     return Result;
   }
-  
-  Result = X.substr(0, I-X.begin());
+
+  if (NeedPrefix)
+    Result = X.substr(0, I-X.begin());
     
   // Otherwise, construct the string the expensive way.
   for (std::string::const_iterator E = X.end(); I != E; ++I) {

Added: llvm/trunk/test/FrontendObjC/2009-08-17-DebugInfo.m
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendObjC/2009-08-17-DebugInfo.m?rev=79289&view=auto

==============================================================================
--- llvm/trunk/test/FrontendObjC/2009-08-17-DebugInfo.m (added)
+++ llvm/trunk/test/FrontendObjC/2009-08-17-DebugInfo.m Mon Aug 17 18:17:17 2009
@@ -0,0 +1,30 @@
+// This is a regression test on debug info to make sure that we can set a
+// breakpoint on a objective message.
+// RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | llc -o %t.s -f -O0 
+// RUN: %compile_c %t.s -o %t.o
+// RUN: %link %t.o -o %t.exe -framework Foundation
+// RUN: echo {break randomFunc\n} > %t.in 
+// RUN: gdb -q -batch -n -x %t.in %t.exe | tee %t.out | \
+// RUN:   grep {Breakpoint 1 at 0x.*: file 2009-08-17-DebugInfo.m, line 22}
+// XTARGETS: darwin
+ at interface MyClass
+{
+ int my;
+}
++ init;
+- randomFunc;
+ at end
+
+ at implementation MyClass
++ init {
+}
+- randomFunc { 
+  my = 42;
+}
+ at end
+
+int main() {
+  id o = [MyClass init];
+  [o randomFunc];
+  return 0;
+}





More information about the llvm-commits mailing list