xref: /aosp_15_r20/external/clang/test/CodeGenCXX/debug-info-class-nolimit.cpp (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 -triple x86_64-unk-unk -debug-info-kind=standalone -o - -emit-llvm %s | FileCheck %s
2*67e74705SXin Li // On Darwin, "full" debug info is the default, so really these tests are
3*67e74705SXin Li // identical, as cc1 no longer chooses the effective value of DebugInfoKind.
4*67e74705SXin Li // RUN: %clang_cc1 -triple x86_64-apple-darwin -debug-info-kind=standalone -o - -emit-llvm %s | FileCheck %s
5*67e74705SXin Li 
6*67e74705SXin Li namespace rdar14101097_1 { // see also PR16214
7*67e74705SXin Li // Check that we emit debug info for the definition of a struct if the
8*67e74705SXin Li // definition is available, even if it's used via a pointer wrapped in a
9*67e74705SXin Li // typedef.
10*67e74705SXin Li // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "foo"
11*67e74705SXin Li // CHECK-NOT:              DIFlagFwdDecl
12*67e74705SXin Li // CHECK-SAME:             ){{$}}
13*67e74705SXin Li struct foo {
14*67e74705SXin Li };
15*67e74705SXin Li 
16*67e74705SXin Li typedef foo *foop;
17*67e74705SXin Li 
bar()18*67e74705SXin Li void bar() {
19*67e74705SXin Li   foop f;
20*67e74705SXin Li }
21*67e74705SXin Li }
22*67e74705SXin Li 
23*67e74705SXin Li namespace rdar14101097_2 {
24*67e74705SXin Li // As above, except trickier because we first encounter only a declaration of
25*67e74705SXin Li // the type and no debug-info related use after we see the definition of the
26*67e74705SXin Li // type.
27*67e74705SXin Li // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "foo"
28*67e74705SXin Li // CHECK-NOT:              DIFlagFwdDecl
29*67e74705SXin Li // CHECK-SAME:             ){{$}}
30*67e74705SXin Li struct foo;
bar()31*67e74705SXin Li void bar() {
32*67e74705SXin Li   foo *f;
33*67e74705SXin Li }
34*67e74705SXin Li struct foo {
35*67e74705SXin Li };
36*67e74705SXin Li }
37