1// RUN: %clang_cc1 -dwarf-version=5 -emit-llvm -debug-info-kind=limited -w -triple x86_64-apple-darwin10 %s -o - | FileCheck %s
2// RUN: %clang_cc1 -dwarf-version=4 -emit-llvm -debug-info-kind=limited -w -triple x86_64-apple-darwin10 %s -o - | FileCheck %s
3// RUN: %clang_cc1 -dwarf-version=5 -emit-llvm -debug-info-kind=limited -w -triple x86_64-apple-darwin10 %s -o - -DDISABLE_DIRECT | FileCheck --check-prefix=CHECK-DISABLED %s
4
5__attribute__((objc_root_class))
6@interface Root
7@end
8
9@implementation Root
10- (int)getInt
11#ifndef DISABLE_DIRECT
12 __attribute__((objc_direct))
13#endif
14{
15  return 42;
16}
17@end
18
19// Test that objc_direct methods are always (even in DWARF < 5) emitted
20// as members of their containing class.
21
22// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "Root",
23// CHECK-SAME:             elements: ![[MEMBERS:[0-9]+]],
24// CHECK-SAME:             runtimeLang: DW_LANG_ObjC)
25// CHECK: ![[MEMBERS]] = !{![[GETTER:[0-9]+]]}
26// CHECK: ![[GETTER]] = !DISubprogram(name: "-[Root getInt]",
27// CHECK-SAME: spFlags: DISPFlagObjCDirect
28
29// CHECK-DISABLED-NOT: DISPFlagObjCDirect
30