Revert "[clang][extract-api] Use relative includes"
[llvm-project.git] / clang / test / ExtractAPI / known_files_only_hmap.c
blob3b7609a73b267e6821377e770bf44ca6865ce155
1 // RUN: rm -rf %t
2 // RUN: split-file %s %t
3 // RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
4 // RUN: %t/reference.output.json.in >> %t/reference.output.json
5 // RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
6 // RUN: %t/known_files_only.hmap.json.in >> %t/known_files_only.hmap.json
7 // RUN: %hmaptool write %t/known_files_only.hmap.json %t/known_files_only.hmap
8 // RUN: %clang -extract-api --product-name=KnownFilesOnlyHmap -target arm64-apple-macosx \
9 // RUN: -I%t/known_files_only.hmap -I%t/subdir %t/subdir/subdir1/input.h \
10 // RUN: %t/subdir/subdir2/known_file.h -o %t/output.json | FileCheck -allow-empty %s
12 // Generator version is not consistent across test runs, normalize it.
13 // RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \
14 // RUN: %t/output.json >> %t/output-normalized.json
15 // RUN: diff %t/reference.output.json %t/output-normalized.json
17 // CHECK-NOT: error:
18 // CHECK-NOT: warning:
19 //--- known_files_only.hmap.json.in
21 "mappings" :
23 "subdir2/known_file.h" : "INPUT_DIR/subdir/subdir3/unknown.h"
27 //--- subdir/subdir1/input.h
28 int num;
29 #include "subdir2/known_file.h"
31 //--- subdir/subdir2/known_file.h
32 int known_num;
34 //--- subdir/subdir3/unknown.h
35 // Ensure that these symbols are not emitted in the Symbol Graph.
36 #ifndef INPUT4_H
37 #define INPUT4_H
39 #define HELLO 1
40 char not_emitted;
41 void foo(int);
42 struct Foo { int a; };
44 #endif
46 //--- reference.output.json.in
48 "metadata": {
49 "formatVersion": {
50 "major": 0,
51 "minor": 5,
52 "patch": 3
54 "generator": "?"
56 "module": {
57 "name": "KnownFilesOnlyHmap",
58 "platform": {
59 "architecture": "arm64",
60 "operatingSystem": {
61 "minimumVersion": {
62 "major": 11,
63 "minor": 0,
64 "patch": 0
66 "name": "macosx"
68 "vendor": "apple"
71 "relationships": [],
72 "symbols": [
74 "accessLevel": "public",
75 "declarationFragments": [
77 "kind": "typeIdentifier",
78 "preciseIdentifier": "c:I",
79 "spelling": "int"
82 "kind": "text",
83 "spelling": " "
86 "kind": "identifier",
87 "spelling": "num"
90 "identifier": {
91 "interfaceLanguage": "c",
92 "precise": "c:@num"
94 "kind": {
95 "displayName": "Global Variable",
96 "identifier": "c.var"
98 "location": {
99 "position": {
100 "character": 5,
101 "line": 1
103 "uri": "file://INPUT_DIR/subdir/subdir1/input.h"
105 "names": {
106 "navigator": [
108 "kind": "identifier",
109 "spelling": "num"
112 "subHeading": [
114 "kind": "identifier",
115 "spelling": "num"
118 "title": "num"
120 "pathComponents": [
121 "num"
125 "accessLevel": "public",
126 "declarationFragments": [
128 "kind": "typeIdentifier",
129 "preciseIdentifier": "c:I",
130 "spelling": "int"
133 "kind": "text",
134 "spelling": " "
137 "kind": "identifier",
138 "spelling": "known_num"
141 "identifier": {
142 "interfaceLanguage": "c",
143 "precise": "c:@known_num"
145 "kind": {
146 "displayName": "Global Variable",
147 "identifier": "c.var"
149 "location": {
150 "position": {
151 "character": 5,
152 "line": 1
154 "uri": "file://INPUT_DIR/subdir/subdir2/known_file.h"
156 "names": {
157 "navigator": [
159 "kind": "identifier",
160 "spelling": "known_num"
163 "subHeading": [
165 "kind": "identifier",
166 "spelling": "known_num"
169 "title": "known_num"
171 "pathComponents": [
172 "known_num"