1RUN: llvm-mc %S/brief.s -filetype obj -triple x86_64-apple-darwin -o - \
2RUN:   | llvm-dwarfdump -name=not_there_at_all - | \
3RUN: FileCheck %s --check-prefix=EMPTY --allow-empty
4EMPTY: {{^$}}
5
6RUN: llvm-mc %S/brief.s -filetype obj -triple x86_64-apple-darwin -o - \
7RUN:   | llvm-dwarfdump -name=main - | FileCheck %s
8CHECK: : DW_TAG_subprogram
9CHECK-NOT: {{:}}
10CHECK:     DW_AT_name ("main")
11CHECK-NOT: {{:}}
12
13RUN: llvm-dwarfdump %S/../../dsymutil/Inputs/libfat-test.a \
14RUN:   -name=x86_64h_var -name=i386_var \
15RUN:   | FileCheck %s --check-prefix=MULTI
16MULTI: Mach-O 32-bit i386
17MULTI-NOT: {{: DW}}
18MULTI: : DW_TAG_variable
19MULTI-NOT: {{: DW}}
20MULTI:    DW_AT_name ("i386_var")
21MULTI-NOT: {{: DW}}
22MULTI: Mach-O 64-bit x86-64
23MULTI: : DW_TAG_variable
24MULTI-NOT: {{: DW}}
25MULTI:    DW_AT_name ("x86_64h_var")
26MULTI-NOT: {{: DW}}
27
28RUN: llvm-mc %S/brief.s -filetype obj -triple x86_64-apple-darwin -o - \
29RUN:   | llvm-dwarfdump -name=int - | FileCheck %s --check-prefix=TYPES
30TYPES: : DW_TAG_base_type
31TYPES-NOT: {{:}}
32TYPES:     DW_AT_name ("int")
33TYPES-NOT: {{:}}
34
35This is one where --name observably behaves different from --find.
36RUN: llvm-dwarfdump %S/../../dsymutil/Inputs/odr-anon-namespace/1.o \
37RUN:    -name="(anonymous namespace)" \
38RUN:   | FileCheck %s --check-prefix=EMPTY
39
40Test the -ignore-case option.
41RUN: llvm-mc %S/brief.s -filetype obj -triple x86_64-apple-darwin -o - \
42RUN:   | llvm-dwarfdump -name=Main - | FileCheck %s -check-prefix=EMPTY
43RUN: llvm-mc %S/brief.s -filetype obj -triple x86_64-apple-darwin -o - \
44RUN:   | llvm-dwarfdump -name=Main -i - | FileCheck %s
45RUN: llvm-mc %S/brief.s -filetype obj -triple x86_64-apple-darwin -o - \
46RUN:   | llvm-dwarfdump -name=MAIN -ignore-case - | FileCheck %s
47
48Test the -regex option.
49RUN: llvm-mc %S/brief.s -filetype obj -triple x86_64-apple-darwin -o - \
50RUN:   | llvm-dwarfdump -regex -name=m.+n - | FileCheck %s
51RUN: llvm-mc %S/brief.s -filetype obj -triple x86_64-apple-darwin -o - \
52RUN:   | llvm-dwarfdump -x -name=m.+n - | FileCheck %s
53RUN: llvm-mc %S/brief.s -filetype obj -triple x86_64-apple-darwin -o - \
54RUN:   | llvm-dwarfdump -x -i -name=M.+n - | FileCheck %s
55RUN: llvm-mc %S/brief.s -filetype obj -triple x86_64-apple-darwin -o - \
56RUN:   | not llvm-dwarfdump -x -name=+ - 2>&1 | FileCheck %s --check-prefix=ERR
57ERR: error
58RUN: llvm-dwarfdump %S/../../dsymutil/Inputs/libfat-test.a \
59RUN:   -x -name=x86_64h_var -name=i386_var \
60RUN:   | FileCheck %s --check-prefix=MULTI
61RUN: llvm-dwarfdump %S/../../dsymutil/Inputs/libfat-test.a \
62RUN:   -x -name=.*86.*_var \
63RUN:   | FileCheck %s --check-prefix=MULTI
64
65Test the -show-children behavior.
66RUN: llvm-mc %S/brief.s -filetype obj -triple x86_64-apple-darwin -o - \
67RUN:   | llvm-dwarfdump -name="brief.c" - | FileCheck %s -check-prefix=NOCHILDREN
68NOCHILDREN: DW_AT_name ("brief.c")
69NOCHILDREN-NOT: DW_TAG
70
71Test that --name also searches in DW_AT_linkage_name.
72RUN: llc -O0 %S/statistics.ll -filetype obj -o - \
73RUN:   | llvm-dwarfdump -name=_Z4cubei - | FileCheck %s --check-prefix=LINKAGE
74LINKAGE: DW_AT_name	("cube")