[cfe-commits] r66212 - in /cfe/trunk: lib/CodeGen/CGDecl.cpp lib/CodeGen/CodeGenModule.cpp test/Coverage/objc-language-features.inc

Daniel Dunbar daniel at zuster.org
Thu Mar 5 14:59:19 PST 2009


Author: ddunbar
Date: Thu Mar  5 16:59:19 2009
New Revision: 66212

URL: http://llvm.org/viewvc/llvm-project?rev=66212&view=rev
Log:
Don't mangle names of local variables.
 - For one thing, this adds unneeded overhead; for another, this
   routine can be used to emit unnamed decls which we shouldn't try to
   mangle.

Modified:
    cfe/trunk/lib/CodeGen/CGDecl.cpp
    cfe/trunk/lib/CodeGen/CodeGenModule.cpp
    cfe/trunk/test/Coverage/objc-language-features.inc

Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=66212&r1=66211&r2=66212&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Thu Mar  5 16:59:19 2009
@@ -236,8 +236,8 @@
       const llvm::Type *LTy = ConvertTypeForMem(Ty);
       if (isByRef)
         LTy = BuildByRefType(Ty, getContext().getDeclAlignInBytes(&D));
-      llvm::AllocaInst *Alloc =
-        CreateTempAlloca(LTy, CGM.getMangledName(&D));
+      llvm::AllocaInst *Alloc = 
+        CreateTempAlloca(LTy, D.getNameAsString().c_str());
       if (isByRef)
         Alloc->setAlignment(std::max(getContext().getDeclAlignInBytes(&D),
                                      getContext().getTypeAlign(getContext().VoidPtrTy) / 8));

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=66212&r1=66211&r2=66212&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Thu Mar  5 16:59:19 2009
@@ -170,8 +170,10 @@
 const char *CodeGenModule::getMangledName(const NamedDecl *ND) {
   llvm::SmallString<256> Name;
   llvm::raw_svector_ostream Out(Name);
-  if (!mangleName(ND, Context, Out))
+  if (!mangleName(ND, Context, Out)) {
+    assert(ND->getIdentifier() && "Attempt to mangle unnamed decl.");
     return ND->getIdentifier()->getName();
+  }
 
   Name += '\0';
   return MangledNames.GetOrCreateValue(Name.begin(), Name.end())

Modified: cfe/trunk/test/Coverage/objc-language-features.inc
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Coverage/objc-language-features.inc?rev=66212&r1=66211&r2=66212&view=diff

==============================================================================
--- cfe/trunk/test/Coverage/objc-language-features.inc (original)
+++ cfe/trunk/test/Coverage/objc-language-features.inc Thu Mar  5 16:59:19 2009
@@ -51,6 +51,9 @@
 @implementation A (Cat)
 @end
 
+ at interface B
+ at end
+
 int f0(id x) {
 #ifndef IRGENABLE_GNU
 #ifndef IRGENABLE
@@ -62,8 +65,13 @@
 #ifndef IRGENABLE_GNU
   @try {
     @throw x;
+
   } @catch(A *e) {
     @throw;
+
+    // @catch param doesn't require name.
+  } @catch(B *) {
+
   } @finally {
     ;
   }





More information about the cfe-commits mailing list