limiting debug info.
FIXME: There is still work left to do here, the testcase should work even with -flimit-debug-info.
rdar://problem/
14101097
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184252
91177308-0d34-0410-b5e6-
96231b3b80d8
/// CreateType - get structure or union type.
llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty, bool Declaration) {
RecordDecl *RD = Ty->getDecl();
- if (Declaration) {
+ if (DebugKind <= CodeGenOptions::LimitedDebugInfo && Declaration) {
llvm::DIDescriptor FDContext =
getContextDescriptor(cast<Decl>(RD->getDeclContext()));
llvm::DIType RetTy = createRecordFwdDecl(RD, FDContext);
--- /dev/null
+// RUN: %clang_cc1 -triple x86_64-unk-unk -fno-limit-debug-info -o - -emit-llvm -g %s | FileCheck %s
+// Check that we emit debug info for a struct even if it is typedef'd before using.
+// rdar://problem/14101097
+//
+// FIXME: This should work with -flimit-debug-info, too.
+//
+// CHECK: [ DW_TAG_member ] [foo]
+// CHECK: [ DW_TAG_member ] [bar]
+struct elusive_s {
+ int foo;
+ float bar;
+};
+typedef struct elusive_s* elusive_t;
+
+int baz(void* x) {
+ elusive_t s = x;
+ return s->foo;
+}
+