]> granicus.if.org Git - clang/commitdiff
Make sure that forward declarations are marked as such in the debug info
authorEric Christopher <echristo@apple.com>
Tue, 29 Nov 2011 23:57:40 +0000 (23:57 +0000)
committerEric Christopher <echristo@apple.com>
Tue, 29 Nov 2011 23:57:40 +0000 (23:57 +0000)
for the structure type.

rdar://10499337

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

lib/CodeGen/CGDebugInfo.cpp
test/CodeGenObjC/debug-info-fwddecl.m [new file with mode: 0644]

index efffd2ca4c2bd2e455645484aa8ae8365828f2dd..922b725d9d37d97388142bb464cf663a3793e6e1 100644 (file)
@@ -1214,7 +1214,8 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty,
   if (ID->isForwardDecl()) {
     llvm::DIType FwdDecl =
       DBuilder.createStructType(Unit, ID->getName(),
-                                DefUnit, Line, 0, 0, 0,
+                                DefUnit, Line, 0, 0,
+                                llvm::DIDescriptor::FlagFwdDecl,
                                 llvm::DIArray(), RuntimeLang);
     return FwdDecl;
   }
diff --git a/test/CodeGenObjC/debug-info-fwddecl.m b/test/CodeGenObjC/debug-info-fwddecl.m
new file mode 100644 (file)
index 0000000..bed632d
--- /dev/null
@@ -0,0 +1,5 @@
+// RUN: %clang -fverbose-asm -g -S -emit-llvm %s -o - | FileCheck %s
+@class ForwardObjcClass;
+ForwardObjcClass *ptr = 0;
+
+// CHECK: !8 = metadata !{i32 720915, metadata !6, metadata !"ForwardObjcClass", metadata !6, i32 2, i64 0, i64 0, i32 0, i32 4, i32 0, null, i32 16, i32 0} ; [ DW_TAG_structure_type ]