]> granicus.if.org Git - clang/commitdiff
Debug info: Explicitly set the DIVariable::isIndirect() flag for VLAs.
authorAdrian Prantl <aprantl@apple.com>
Wed, 18 Sep 2013 22:08:57 +0000 (22:08 +0000)
committerAdrian Prantl <aprantl@apple.com>
Wed, 18 Sep 2013 22:08:57 +0000 (22:08 +0000)
This allows us to get rid of an ugly hack in the backend.
Paired commit with LLVM.

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

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

index 0069d577f24a431b9ef3b8a7b6908f6885f4f45e..23b73a31f0385529eb8fac565126fd15d5a85513 100644 (file)
@@ -2747,6 +2747,8 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, unsigned Tag,
         DBuilder.insertDeclare(Storage, D, Builder.GetInsertBlock());
       Call->setDebugLoc(llvm::DebugLoc::get(Line, Column, Scope));
       return;
+    } else if (isa<VariableArrayType>(VD->getType())) {
+      Flags |= llvm::DIDescriptor::FlagIndirectVariable;
     }
   } else if (const RecordType *RT = dyn_cast<RecordType>(VD->getType())) {
     // If VD is an anonymous union then Storage represents value for
index 2e173e4a3f665155c195a5f1c39bddec275bc949..7a8da960db4713b96a9917acc26d20210638cddc 100644 (file)
@@ -2,7 +2,7 @@
 
 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]]]
+// CHECK: metadata !{i32 {{.*}}, metadata {{.*}}, metadata !"vla", metadata {{.*}}, i32 [[@LINE+1]], metadata {{.*}}, i32 8192, i32 0} ; [ DW_TAG_auto_variable ] [vla] [line [[@LINE+1]]]
   int vla[s];
   int i;
   for (i = 0; i < s; i++) {