]> granicus.if.org Git - clang/commitdiff
Reapply an improved version of r180816/180817.
authorAdrian Prantl <aprantl@apple.com>
Tue, 9 Jul 2013 20:29:03 +0000 (20:29 +0000)
committerAdrian Prantl <aprantl@apple.com>
Tue, 9 Jul 2013 20:29:03 +0000 (20:29 +0000)
Do not generate VLAs as complex variables any more, as they are now
correctly represented as breg+0 locations in the backend.

(Paired commit with LLVM: r185966)

rdar://problem/13658587

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

lib/CodeGen/CGDebugInfo.cpp
test/CodeGen/debug-info-vla.c

index ec5447add463c04aa6cc41fe3b8405b9bff43533..e5fb06a7437d2a94bfd21e415e1b65f858db3b78 100644 (file)
@@ -2666,22 +2666,6 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, unsigned Tag,
                                        VD->getName(), Unit, Line, Ty,
                                        addr, 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;
-    } else if (isa<VariableArrayType>(VD->getType())) {
-      // These are "complex" variables in that they need an op_deref.
-      // Create the descriptor for the variable.
-      llvm::Value *Addr = llvm::ConstantInt::get(CGM.Int64Ty,
-                                                 llvm::DIBuilder::OpDeref);
-      llvm::DIVariable D =
-        DBuilder.createComplexVariable(Tag,
-                                       llvm::DIDescriptor(Scope),
-                                       Name, Unit, Line, Ty,
-                                       Addr, ArgNo);
-
       // Insert an llvm.dbg.declare into the current block.
       llvm::Instruction *Call =
         DBuilder.insertDeclare(Storage, D, Builder.GetInsertBlock());
index 20fb6aace41fbe2bb7574be79c92a59f3464daae..2e173e4a3f665155c195a5f1c39bddec275bc949 100644 (file)
@@ -1,9 +1,8 @@
 // RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin %s -o - | FileCheck %s
 
-// CHECK: metadata !{i32 {{.*}}, metadata {{.*}}, metadata !"vla", metadata {{.*}}, i32 7, metadata {{.*}}, i32 0, i32 0, i64 2} ; [ DW_TAG_auto_variable ]
-
 void testVLAwithSize(int s)
 {
+// CHECK: metadata !{i32 {{.*}}, metadata {{.*}}, metadata !"vla", metadata {{.*}}, i32 [[@LINE+1]], metadata {{.*}}, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [vla] [line [[@LINE+1]]]
   int vla[s];
   int i;
   for (i = 0; i < s; i++) {