]> granicus.if.org Git - clang/commitdiff
Emit debug info for unnamed parameters.
authorDavid Blaikie <dblaikie@gmail.com>
Sat, 5 Jan 2013 05:58:35 +0000 (05:58 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Sat, 5 Jan 2013 05:58:35 +0000 (05:58 +0000)
LLVM ignores this data for now - patch for that to follow.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171605 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDebugInfo.cpp
test/CodeGenCXX/debug-info-method.cpp

index f14834f03a156a1e7bb9de15bf24a590f3295c60..1ec9464e8ad52798bd6edd797308fbcb11afb460 100644 (file)
@@ -2428,23 +2428,9 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, unsigned Tag,
       Call->setDebugLoc(llvm::DebugLoc::get(Line, Column, Scope));
       return;
     }
-    
-    // Create the descriptor for the variable.
-    llvm::DIVariable D =
-      DBuilder.createLocalVariable(Tag, llvm::DIDescriptor(Scope), 
-                                   Name, Unit, Line, Ty, 
-                                   CGM.getLangOpts().Optimize, Flags, ArgNo);
-    
-    // Insert an llvm.dbg.declare into the current block.
-    llvm::Instruction *Call =
-      DBuilder.insertDeclare(Storage, D, Builder.GetInsertBlock());
-    Call->setDebugLoc(llvm::DebugLoc::get(Line, Column, Scope));
-    return;
-  }
-  
-  // If VD is an anonymous union then Storage represents value for
-  // all union fields.
-  if (const RecordType *RT = dyn_cast<RecordType>(VD->getType())) {
+  } else if (const RecordType *RT = dyn_cast<RecordType>(VD->getType())) {
+    // If VD is an anonymous union then Storage represents value for
+    // all union fields.
     const RecordDecl *RD = cast<RecordDecl>(RT->getDecl());
     if (RD->isUnion()) {
       for (RecordDecl::field_iterator I = RD->field_begin(),
@@ -2471,7 +2457,19 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, unsigned Tag,
         Call->setDebugLoc(llvm::DebugLoc::get(Line, Column, Scope));
       }
     }
+    return;
   }
+
+  // Create the descriptor for the variable.
+  llvm::DIVariable D =
+    DBuilder.createLocalVariable(Tag, llvm::DIDescriptor(Scope),
+                                 Name, Unit, Line, Ty,
+                                 CGM.getLangOpts().Optimize, Flags, ArgNo);
+
+  // Insert an llvm.dbg.declare into the current block.
+  llvm::Instruction *Call =
+    DBuilder.insertDeclare(Storage, D, Builder.GetInsertBlock());
+  Call->setDebugLoc(llvm::DebugLoc::get(Line, Column, Scope));
 }
 
 void CGDebugInfo::EmitDeclareOfAutoVariable(const VarDecl *VD,
index 5221e372106f5071e07aceb56baa617c054908c1..74e44d1072808870595371acb9c359704c50fe4f 100644 (file)
@@ -1,7 +1,12 @@
 // RUN: %clang_cc1 -emit-llvm -g %s -o - | FileCheck %s
-// CHECK: metadata !"_ZN1A3fooEv", {{.*}}, i32 258
+// CHECK: metadata !"_ZN1A3fooEi", {{.*}}, i32 258
+// CHECK: ""{{.*}}DW_TAG_arg_variable
 class A {
 protected:
-  int foo();
+  void foo(int);
 }; 
+
+void A::foo(int) {
+}
+
 A a;