]> granicus.if.org Git - clang/commitdiff
Revert 75648 for now. It is causing test failures.
authorDevang Patel <dpatel@apple.com>
Tue, 14 Jul 2009 21:31:22 +0000 (21:31 +0000)
committerDevang Patel <dpatel@apple.com>
Tue, 14 Jul 2009 21:31:22 +0000 (21:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75684 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDebugInfo.cpp
lib/CodeGen/CGDebugInfo.h
lib/CodeGen/CodeGenModule.cpp
test/CodeGenObjC/debug-info-linkagename.m
test/CodeGenObjC/debug-info.m

index 3d7548e293dd29399900713a69a0417f78bac764..a5e4b2f3adb1d08be670649fea85d548223f9d41 100644 (file)
@@ -19,7 +19,6 @@
 #include "clang/AST/Expr.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/FileManager.h"
-#include "clang/Basic/TargetInfo.h"
 #include "clang/Frontend/CompileOptions.h"
 #include "llvm/Constants.h"
 #include "llvm/DerivedTypes.h"
 using namespace clang;
 using namespace clang::CodeGen;
 
-CGDebugInfo::CGDebugInfo(CodeGenModule *m, TargetInfo *t)
+CGDebugInfo::CGDebugInfo(CodeGenModule *m)
   : M(m), isMainCompileUnitCreated(false), DebugFactory(M->getModule()),
     BlockLiteralGenericSet(false) {
-  LLVMMangler = new llvm::Mangler(m->getModule(), t->getUserLabelPrefix(), ".");
-  // add chars used in ObjC method names so method names aren't mangled
-  LLVMMangler->markCharAcceptable('[');
-  LLVMMangler->markCharAcceptable(']');
-  LLVMMangler->markCharAcceptable('(');
-  LLVMMangler->markCharAcceptable(')');
-  LLVMMangler->markCharAcceptable('-');
-  LLVMMangler->markCharAcceptable('+');
-  LLVMMangler->markCharAcceptable(' ');
 }
 
 CGDebugInfo::~CGDebugInfo() {
-  delete LLVMMangler;
   assert(RegionStack.empty() && "Region stack mismatch, stack not empty!");
 }
 
@@ -831,6 +820,8 @@ llvm::DIType CGDebugInfo::getOrCreateType(QualType Ty,
 void CGDebugInfo::EmitFunctionStart(const char *Name, QualType ReturnType,
                                     llvm::Function *Fn,
                                     CGBuilderTy &Builder) {
+  const char *LinkageName = Name;
+  
   // Skip the asm prefix if it exists.
   //
   // FIXME: This should probably be the unmangled name?
@@ -843,9 +834,7 @@ void CGDebugInfo::EmitFunctionStart(const char *Name, QualType ReturnType,
   unsigned LineNo = SM.getPresumedLoc(CurLoc).getLine();
   
   llvm::DISubprogram SP =
-    DebugFactory.CreateSubprogram(Unit, Name, Name,
-                                  LLVMMangler->getMangledName(Fn), 
-                                  Unit, LineNo,
+    DebugFactory.CreateSubprogram(Unit, Name, Name, LinkageName, Unit, LineNo,
                                   getOrCreateType(ReturnType, Unit),
                                   Fn->hasInternalLinkage(), true/*definition*/);
   
@@ -980,9 +969,7 @@ void CGDebugInfo::EmitGlobalVariable(llvm::GlobalVariable *Var,
                                            ArrayType::Normal, 0);
   }
 
-  DebugFactory.CreateGlobalVariable(Unit, Name, Name, 
-                                    LLVMMangler->getMangledName(Var),
-                                    Unit, LineNo,
+  DebugFactory.CreateGlobalVariable(Unit, Name, Name, "", Unit, LineNo,
                                     getOrCreateType(T, Unit),
                                     Var->hasInternalLinkage(),
                                     true/*definition*/, Var);
@@ -1012,9 +999,7 @@ void CGDebugInfo::EmitGlobalVariable(llvm::GlobalVariable *Var,
                                            ArrayType::Normal, 0);
   }
 
-  DebugFactory.CreateGlobalVariable(Unit, Name, Name, 
-                                    LLVMMangler->getMangledName(Var),
-                                    Unit, LineNo,
+  DebugFactory.CreateGlobalVariable(Unit, Name, Name, "", Unit, LineNo,
                                     getOrCreateType(T, Unit),
                                     Var->hasInternalLinkage(),
                                     true/*definition*/, Var);
index 5cb5f09da821936a70ccb15e7500d54c164c0077..ac28e5b879ed5820046cd8be36500894b2c72c94 100644 (file)
@@ -16,7 +16,6 @@
 
 #include "clang/AST/Type.h"
 #include "clang/Basic/SourceLocation.h"
-#include "llvm/Support/Mangler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/Analysis/DebugInfo.h"
 #include <map>
@@ -26,7 +25,6 @@
 namespace clang {
   class VarDecl;
   class ObjCInterfaceDecl;
-  class TargetInfo;
 
 namespace CodeGen {
   class CodeGenModule;
@@ -36,7 +34,6 @@ namespace CodeGen {
 /// the backend.
 class CGDebugInfo {
   CodeGenModule *M;
-  llvm::Mangler *LLVMMangler;
   bool isMainCompileUnitCreated;
   llvm::DIFactory DebugFactory;
   
@@ -71,7 +68,7 @@ class CGDebugInfo {
   llvm::DIType CreateType(const ArrayType *Ty, llvm::DICompileUnit U);
 
 public:
-  CGDebugInfo(CodeGenModule *m, TargetInfo *t);
+  CGDebugInfo(CodeGenModule *m);
   ~CGDebugInfo();
 
   /// setLocation - Update the current source location. If \arg loc is
index 9ac68718a5c1a6945e29ccd65e92e00b4bc1861e..b516da9a7284d57e9e28d0e8110e08ed67f76b1b 100644 (file)
@@ -52,9 +52,7 @@ CodeGenModule::CodeGenModule(ASTContext &C, const CompileOptions &compileOpts,
     Runtime = CreateMacObjCRuntime(*this);
 
   // If debug info generation is enabled, create the CGDebugInfo object.
-  DebugInfo = 0;
-  if (CompileOpts.DebugInfo)
-    DebugInfo = new CGDebugInfo(this, &Context.Target);
+  DebugInfo = CompileOpts.DebugInfo ? new CGDebugInfo(this) : 0;
 }
 
 CodeGenModule::~CodeGenModule() {
index bda98eec49b5fdb5f54ea2a829fd82588cf5a5b3..dfd1dfa98b3ac0550ed92f2c7704dca93f3970fd 100644 (file)
@@ -1,5 +1,7 @@
 // RUN: clang-cc  -g -S -o %t %s
 // RUN: not grep 001 %t
+// XFAIL
+
 
 @interface F 
 -(int) bar;
index 9f4477449517dbbe117a647acd3668a8d1daf15d..519706be7966d8ceb3aca25d587e252044bc6746 100644 (file)
@@ -1,7 +1,7 @@
 // RUN: clang-cc -triple i386-apple-darwin9 -g -emit-llvm -o %t %s &&
 // RUN: grep '@.str3 = internal constant \[8 x i8\] c"-\[A m0\]\\00"' %t &&
-// RUN: grep '@.str4 = internal constant \[2 x i8\] c"A\\00"' %t &&
-// RUN: grep '@llvm.dbg.subprogram = .* @.str3, .* @.str3, .* @.str3,' %t &&
+// RUN: grep '@.str4 = internal constant \[9 x i8\] c"\\01-\[A m0\]\\00"' %t &&
+// RUN: grep '@llvm.dbg.subprogram = .* @.str3, .* @.str3, .* @.str4,' %t &&
 // RUN: grep '@llvm.dbg.composite.* = .* i32 15, i64 0, i64 8, .* i32 16' %t &&
 // RUN: true