aboutsummaryrefslogtreecommitdiff
path: root/clang/test/ExtractAPI
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/ExtractAPI')
-rw-r--r--clang/test/ExtractAPI/anonymous_record_no_typedef.c3
-rw-r--r--clang/test/ExtractAPI/availability.c2
-rw-r--r--clang/test/ExtractAPI/bool.c2
-rw-r--r--clang/test/ExtractAPI/bool.cpp2
-rw-r--r--clang/test/ExtractAPI/class.cpp2
-rw-r--r--clang/test/ExtractAPI/class_template.cpp2
-rw-r--r--clang/test/ExtractAPI/class_template_param_inheritance.cpp2
-rw-r--r--clang/test/ExtractAPI/class_template_partial_spec.cpp4
-rw-r--r--clang/test/ExtractAPI/class_template_spec.cpp2
-rw-r--r--clang/test/ExtractAPI/concept.cpp2
-rw-r--r--clang/test/ExtractAPI/constructor_destructor.cpp6
-rw-r--r--clang/test/ExtractAPI/conversions.cpp2
-rw-r--r--clang/test/ExtractAPI/emit-symbol-graph/multi_file.c7
-rw-r--r--clang/test/ExtractAPI/emit-symbol-graph/single_file.c5
-rw-r--r--clang/test/ExtractAPI/enum.c2
-rw-r--r--clang/test/ExtractAPI/field_template.cpp2
-rw-r--r--clang/test/ExtractAPI/function_noexcepts.cpp2
-rw-r--r--clang/test/ExtractAPI/global_func_template.cpp2
-rw-r--r--clang/test/ExtractAPI/global_func_template_spec.cpp2
-rw-r--r--clang/test/ExtractAPI/global_record.c2
-rw-r--r--clang/test/ExtractAPI/global_record_multifile.c2
-rw-r--r--clang/test/ExtractAPI/global_var_template.cpp2
-rw-r--r--clang/test/ExtractAPI/global_var_template_partial_spec.cpp2
-rw-r--r--clang/test/ExtractAPI/global_var_template_spec.cpp2
-rw-r--r--clang/test/ExtractAPI/known_files_only.c101
-rw-r--r--clang/test/ExtractAPI/language.c6
-rw-r--r--clang/test/ExtractAPI/macro_undefined.c2
-rw-r--r--clang/test/ExtractAPI/macros.c2
-rw-r--r--clang/test/ExtractAPI/metadata_and_module.c32
-rw-r--r--clang/test/ExtractAPI/method_template.cpp2
-rw-r--r--clang/test/ExtractAPI/method_template_spec.cpp2
-rw-r--r--clang/test/ExtractAPI/methods.cpp660
-rw-r--r--clang/test/ExtractAPI/multiple_inheritance.cpp2
-rw-r--r--clang/test/ExtractAPI/namespace.cpp2
-rw-r--r--clang/test/ExtractAPI/nested_namespaces.cpp2
-rw-r--r--clang/test/ExtractAPI/objc_block.m1567
-rw-r--r--clang/test/ExtractAPI/objc_category.m338
-rw-r--r--clang/test/ExtractAPI/objc_external_category.m49
-rw-r--r--clang/test/ExtractAPI/objc_id_protocol.m357
-rw-r--r--clang/test/ExtractAPI/objc_instancetype.m4
-rw-r--r--clang/test/ExtractAPI/objc_interface.m1033
-rw-r--r--clang/test/ExtractAPI/objc_module_category.m404
-rw-r--r--clang/test/ExtractAPI/objc_property.m600
-rw-r--r--clang/test/ExtractAPI/objc_protocol.m2
-rw-r--r--clang/test/ExtractAPI/objc_various_categories.m507
-rw-r--r--clang/test/ExtractAPI/operator_overload.cpp2
-rw-r--r--clang/test/ExtractAPI/relative_include.m2
-rw-r--r--clang/test/ExtractAPI/simple_inheritance.cpp2
-rw-r--r--clang/test/ExtractAPI/struct.c2
-rw-r--r--clang/test/ExtractAPI/typedef.c464
-rw-r--r--clang/test/ExtractAPI/typedef_anonymous_record.c612
-rw-r--r--clang/test/ExtractAPI/typedef_chain.c2
-rw-r--r--clang/test/ExtractAPI/typedef_struct_enum.c561
-rw-r--r--clang/test/ExtractAPI/underscored.c411
-rw-r--r--clang/test/ExtractAPI/union.c4
-rw-r--r--clang/test/ExtractAPI/vfs_redirected_include.m2
56 files changed, 1751 insertions, 6050 deletions
diff --git a/clang/test/ExtractAPI/anonymous_record_no_typedef.c b/clang/test/ExtractAPI/anonymous_record_no_typedef.c
index 0e50f4a..049e8b1 100644
--- a/clang/test/ExtractAPI/anonymous_record_no_typedef.c
+++ b/clang/test/ExtractAPI/anonymous_record_no_typedef.c
@@ -1,8 +1,9 @@
+// XFAIL: *
// RUN: rm -rf %t
// RUN: split-file %s %t
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang_cc1 -extract-api -triple arm64-apple-macosx \
+// RUN: %clang_cc1 -extract-api --pretty-sgf -triple arm64-apple-macosx \
// RUN: -x c-header %t/input.h -o %t/output.json -verify
// Generator version is not consistent across test runs, normalize it.
diff --git a/clang/test/ExtractAPI/availability.c b/clang/test/ExtractAPI/availability.c
index 3c1ef5c..12ac73f 100644
--- a/clang/test/ExtractAPI/availability.c
+++ b/clang/test/ExtractAPI/availability.c
@@ -2,7 +2,7 @@
// RUN: split-file %s %t
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang_cc1 -extract-api --product-name=Availability -triple arm64-apple-macosx -x c-header %t/input.h -o %t/output.json -verify
+// RUN: %clang_cc1 -extract-api --pretty-sgf --product-name=Availability -triple arm64-apple-macosx -x c-header %t/input.h -o %t/output.json -verify
// Generator version is not consistent across test runs, normalize it.
// RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \
diff --git a/clang/test/ExtractAPI/bool.c b/clang/test/ExtractAPI/bool.c
index f4082ed..efab6df 100644
--- a/clang/test/ExtractAPI/bool.c
+++ b/clang/test/ExtractAPI/bool.c
@@ -2,7 +2,7 @@
// RUN: split-file %s %t
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang -extract-api -target arm64-apple-macosx \
+// RUN: %clang -extract-api --pretty-sgf -target arm64-apple-macosx \
// RUN: %t/input.h -o %t/output.json
// Generator version is not consistent across test runs, normalize it.
diff --git a/clang/test/ExtractAPI/bool.cpp b/clang/test/ExtractAPI/bool.cpp
index 1b445e2..f7d10c6 100644
--- a/clang/test/ExtractAPI/bool.cpp
+++ b/clang/test/ExtractAPI/bool.cpp
@@ -2,7 +2,7 @@
// RUN: split-file %s %t
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang_cc1 -extract-api -triple arm64-apple-macosx \
+// RUN: %clang_cc1 -extract-api --pretty-sgf -triple arm64-apple-macosx \
// RUN: -x c++-header %t/input.h -o %t/output.json -verify
// Generator version is not consistent across test runs, normalize it.
diff --git a/clang/test/ExtractAPI/class.cpp b/clang/test/ExtractAPI/class.cpp
index 21cac43..0c5db8e 100644
--- a/clang/test/ExtractAPI/class.cpp
+++ b/clang/test/ExtractAPI/class.cpp
@@ -2,7 +2,7 @@
// RUN: split-file %s %t
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang_cc1 -extract-api -triple arm64-apple-macosx \
+// RUN: %clang_cc1 -extract-api --pretty-sgf -triple arm64-apple-macosx \
// RUN: -x c++-header %t/input.h -o %t/output.json -verify
// Generator version is not consistent across test runs, normalize it.
diff --git a/clang/test/ExtractAPI/class_template.cpp b/clang/test/ExtractAPI/class_template.cpp
index b04dca6..4f2670d 100644
--- a/clang/test/ExtractAPI/class_template.cpp
+++ b/clang/test/ExtractAPI/class_template.cpp
@@ -2,7 +2,7 @@
// RUN: split-file %s %t
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang_cc1 -extract-api -triple arm64-apple-macosx \
+// RUN: %clang_cc1 -extract-api --pretty-sgf -triple arm64-apple-macosx \
// RUN: -x c++-header %t/input.h -o %t/output.json -verify
// Generator version is not consistent across test runs, normalize it.
diff --git a/clang/test/ExtractAPI/class_template_param_inheritance.cpp b/clang/test/ExtractAPI/class_template_param_inheritance.cpp
index 0d38fd1..3d7b09f 100644
--- a/clang/test/ExtractAPI/class_template_param_inheritance.cpp
+++ b/clang/test/ExtractAPI/class_template_param_inheritance.cpp
@@ -2,7 +2,7 @@
// RUN: split-file %s %t
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang_cc1 -extract-api -triple arm64-apple-macosx \
+// RUN: %clang_cc1 -extract-api --pretty-sgf -triple arm64-apple-macosx \
// RUN: -x c++-header %t/input.h -o %t/output.json -verify
// Generator version is not consistent across test runs, normalize it.
diff --git a/clang/test/ExtractAPI/class_template_partial_spec.cpp b/clang/test/ExtractAPI/class_template_partial_spec.cpp
index eba0693..c8d9cc7 100644
--- a/clang/test/ExtractAPI/class_template_partial_spec.cpp
+++ b/clang/test/ExtractAPI/class_template_partial_spec.cpp
@@ -2,7 +2,7 @@
// RUN: split-file %s %t
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang_cc1 -extract-api -triple arm64-apple-macosx \
+// RUN: %clang_cc1 -extract-api --pretty-sgf -triple arm64-apple-macosx \
// RUN: -x c++-header %t/input.h -o %t/output.json -verify
// Generator version is not consistent across test runs, normalize it.
@@ -15,7 +15,7 @@ template<typename X, typename Y> class Foo {};
template<typename Z> class Foo<Z, int> {};
-/// expected-no-diagnostics
+// expected-no-diagnostics
//--- reference.output.json.in
{
diff --git a/clang/test/ExtractAPI/class_template_spec.cpp b/clang/test/ExtractAPI/class_template_spec.cpp
index 4b183cb..06a9531 100644
--- a/clang/test/ExtractAPI/class_template_spec.cpp
+++ b/clang/test/ExtractAPI/class_template_spec.cpp
@@ -2,7 +2,7 @@
// RUN: split-file %s %t
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang_cc1 -extract-api -triple arm64-apple-macosx \
+// RUN: %clang_cc1 -extract-api --pretty-sgf -triple arm64-apple-macosx \
// RUN: -x c++-header %t/input.h -o %t/output.json -verify
// Generator version is not consistent across test runs, normalize it.
diff --git a/clang/test/ExtractAPI/concept.cpp b/clang/test/ExtractAPI/concept.cpp
index ff4e710..443eac2 100644
--- a/clang/test/ExtractAPI/concept.cpp
+++ b/clang/test/ExtractAPI/concept.cpp
@@ -2,7 +2,7 @@
// RUN: split-file %s %t
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang_cc1 -std=c++20 -extract-api -triple arm64-apple-macosx \
+// RUN: %clang_cc1 -std=c++20 -extract-api --pretty-sgf -triple arm64-apple-macosx \
// RUN: -x c++-header %t/input.h -o %t/output.json -verify
// Generator version is not consistent across test runs, normalize it.
diff --git a/clang/test/ExtractAPI/constructor_destructor.cpp b/clang/test/ExtractAPI/constructor_destructor.cpp
index 9742d4b..27112c9 100644
--- a/clang/test/ExtractAPI/constructor_destructor.cpp
+++ b/clang/test/ExtractAPI/constructor_destructor.cpp
@@ -2,7 +2,7 @@
// RUN: split-file %s %t
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang_cc1 -extract-api -triple arm64-apple-macosx \
+// RUN: %clang_cc1 -extract-api --pretty-sgf -triple arm64-apple-macosx \
// RUN: -x c++-header %t/input.h -o %t/output.json -verify
// Generator version is not consistent across test runs, normalize it.
@@ -137,7 +137,7 @@ class Foo {
"precise": "c:@S@Foo@F@Foo#"
},
"kind": {
- "displayName": "Instance Method",
+ "displayName": "Constructor",
"identifier": "c++.method"
},
"location": {
@@ -193,7 +193,7 @@ class Foo {
"precise": "c:@S@Foo@F@~Foo#"
},
"kind": {
- "displayName": "Instance Method",
+ "displayName": "Destructor",
"identifier": "c++.method"
},
"location": {
diff --git a/clang/test/ExtractAPI/conversions.cpp b/clang/test/ExtractAPI/conversions.cpp
index fc8d067..07688ff 100644
--- a/clang/test/ExtractAPI/conversions.cpp
+++ b/clang/test/ExtractAPI/conversions.cpp
@@ -2,7 +2,7 @@
// RUN: split-file %s %t
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang_cc1 -extract-api -triple arm64-apple-macosx \
+// RUN: %clang_cc1 -extract-api --pretty-sgf -triple arm64-apple-macosx \
// RUN: -x c++-header %t/input.h -o %t/output.json -verify
// Generator version is not consistent across test runs, normalize it.
diff --git a/clang/test/ExtractAPI/emit-symbol-graph/multi_file.c b/clang/test/ExtractAPI/emit-symbol-graph/multi_file.c
index e6b72d5..e668f69 100644
--- a/clang/test/ExtractAPI/emit-symbol-graph/multi_file.c
+++ b/clang/test/ExtractAPI/emit-symbol-graph/multi_file.c
@@ -5,18 +5,19 @@
// RUN: %t/reference.main.json.in >> %t/reference.main.json
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/reference.test.json.in >> %t/reference.test.json
-// RUN: %clang_cc1 %t/test.c %t/main.c --emit-symbol-graph=%t/SymbolGraphs --product-name=multifile_test -triple=x86_64-apple-macosx12.0.0
+// RUN: %clang_cc1 %t/test.c %t/main.c -emit-symbol-graph --pretty-sgf \
+// RUN: --symbol-graph-dir=%t/SymbolGraphs --product-name=multifile_test -triple=x86_64-apple-macosx12.0.0
// Test main.json
// Generator version is not consistent across test runs, normalize it.
// RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \
-// RUN: %t/SymbolGraphs/main.json > %t/output-normalized.json
+// RUN: %t/SymbolGraphs/main.c.symbols.json > %t/output-normalized.json
// RUN: diff %t/reference.main.json %t/output-normalized.json
// Test test.json
// Generator version is not consistent across test runs, normalize it.
// RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \
-// RUN: %t/SymbolGraphs/test.json > %t/output-normalized.json
+// RUN: %t/SymbolGraphs/test.c.symbols.json > %t/output-normalized.json
// RUN: diff %t/reference.test.json %t/output-normalized.json
// CHECK-NOT: error:
diff --git a/clang/test/ExtractAPI/emit-symbol-graph/single_file.c b/clang/test/ExtractAPI/emit-symbol-graph/single_file.c
index 8599e82..b00b5f5 100644
--- a/clang/test/ExtractAPI/emit-symbol-graph/single_file.c
+++ b/clang/test/ExtractAPI/emit-symbol-graph/single_file.c
@@ -3,11 +3,12 @@
// RUN: split-file %s %t
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang_cc1 %t/main.c --emit-symbol-graph=%t/SymbolGraphs --product-name=basicfile -triple=x86_64-apple-macosx12.0.0
+// RUN: %clang_cc1 %t/main.c -emit-symbol-graph --pretty-sgf \
+// RUN: --symbol-graph-dir=%t/SymbolGraphs --product-name=basicfile -triple=x86_64-apple-macosx12.0.0
// Generator version is not consistent across test runs, normalize it.
// RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \
-// RUN: %t/SymbolGraphs/main.json >> %t/output-normalized.json
+// RUN: %t/SymbolGraphs/main.c.symbols.json >> %t/output-normalized.json
// RUN: diff %t/reference.output.json %t/output-normalized.json
// CHECK-NOT: error:
diff --git a/clang/test/ExtractAPI/enum.c b/clang/test/ExtractAPI/enum.c
index 94499d9..1cdf45c 100644
--- a/clang/test/ExtractAPI/enum.c
+++ b/clang/test/ExtractAPI/enum.c
@@ -2,7 +2,7 @@
// RUN: split-file %s %t
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang_cc1 -extract-api -triple arm64-apple-macosx \
+// RUN: %clang_cc1 -extract-api --pretty-sgf -triple arm64-apple-macosx \
// RUN: -x c-header %t/input.h -o %t/output.json -verify
// Generator version is not consistent across test runs, normalize it.
diff --git a/clang/test/ExtractAPI/field_template.cpp b/clang/test/ExtractAPI/field_template.cpp
index f05e826..2058ed0 100644
--- a/clang/test/ExtractAPI/field_template.cpp
+++ b/clang/test/ExtractAPI/field_template.cpp
@@ -2,7 +2,7 @@
// RUN: split-file %s %t
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang_cc1 -extract-api -triple arm64-apple-macosx \
+// RUN: %clang_cc1 -extract-api --pretty-sgf -triple arm64-apple-macosx \
// RUN: -x c++-header %t/input.h -o %t/output.json -verify
// Generator version is not consistent across test runs, normalize it.
diff --git a/clang/test/ExtractAPI/function_noexcepts.cpp b/clang/test/ExtractAPI/function_noexcepts.cpp
index 3fc7263..d95eaaa 100644
--- a/clang/test/ExtractAPI/function_noexcepts.cpp
+++ b/clang/test/ExtractAPI/function_noexcepts.cpp
@@ -2,7 +2,7 @@
// RUN: split-file %s %t
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang_cc1 -extract-api -triple arm64-apple-macosx \
+// RUN: %clang_cc1 -extract-api --pretty-sgf -triple arm64-apple-macosx \
// RUN: -x c++-header %t/input.h -o %t/output.json -verify
// Generator version is not consistent across test runs, normalize it.
diff --git a/clang/test/ExtractAPI/global_func_template.cpp b/clang/test/ExtractAPI/global_func_template.cpp
index 8def974..f43a618 100644
--- a/clang/test/ExtractAPI/global_func_template.cpp
+++ b/clang/test/ExtractAPI/global_func_template.cpp
@@ -2,7 +2,7 @@
// RUN: split-file %s %t
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang_cc1 -extract-api -triple arm64-apple-macosx \
+// RUN: %clang_cc1 -extract-api --pretty-sgf -triple arm64-apple-macosx \
// RUN: -x c++-header %t/input.h -o %t/output.json -verify
// Generator version is not consistent across test runs, normalize it.
diff --git a/clang/test/ExtractAPI/global_func_template_spec.cpp b/clang/test/ExtractAPI/global_func_template_spec.cpp
index a24263d..fe046e9 100644
--- a/clang/test/ExtractAPI/global_func_template_spec.cpp
+++ b/clang/test/ExtractAPI/global_func_template_spec.cpp
@@ -2,7 +2,7 @@
// RUN: split-file %s %t
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang_cc1 -extract-api -triple arm64-apple-macosx \
+// RUN: %clang_cc1 -extract-api --pretty-sgf -triple arm64-apple-macosx \
// RUN: -x c++-header %t/input.h -o %t/output.json -verify
// Generator version is not consistent across test runs, normalize it.
diff --git a/clang/test/ExtractAPI/global_record.c b/clang/test/ExtractAPI/global_record.c
index 623032b..a08d51d 100644
--- a/clang/test/ExtractAPI/global_record.c
+++ b/clang/test/ExtractAPI/global_record.c
@@ -2,7 +2,7 @@
// RUN: split-file %s %t
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang -extract-api --product-name=GlobalRecord -target arm64-apple-macosx \
+// RUN: %clang -extract-api --pretty-sgf --product-name=GlobalRecord -target arm64-apple-macosx \
// RUN: %t/input.h -o %t/output.json | FileCheck -allow-empty %s
// Generator version is not consistent across test runs, normalize it.
diff --git a/clang/test/ExtractAPI/global_record_multifile.c b/clang/test/ExtractAPI/global_record_multifile.c
index f9d3889..ffdfbcb 100644
--- a/clang/test/ExtractAPI/global_record_multifile.c
+++ b/clang/test/ExtractAPI/global_record_multifile.c
@@ -2,7 +2,7 @@
// RUN: split-file %s %t
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang -extract-api --product-name=GlobalRecord -target arm64-apple-macosx \
+// RUN: %clang -extract-api --pretty-sgf --product-name=GlobalRecord -target arm64-apple-macosx \
// RUN: %t/input1.h %t/input2.h %t/input3.h -o %t/output.json | FileCheck -allow-empty %s
// Generator version is not consistent across test runs, normalize it.
diff --git a/clang/test/ExtractAPI/global_var_template.cpp b/clang/test/ExtractAPI/global_var_template.cpp
index bee2ea6..94f3713 100644
--- a/clang/test/ExtractAPI/global_var_template.cpp
+++ b/clang/test/ExtractAPI/global_var_template.cpp
@@ -2,7 +2,7 @@
// RUN: split-file %s %t
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang_cc1 -extract-api -triple arm64-apple-macosx \
+// RUN: %clang_cc1 -extract-api --pretty-sgf -triple arm64-apple-macosx \
// RUN: -x c++-header %t/input.h -o %t/output.json -verify
// Generator version is not consistent across test runs, normalize it.
diff --git a/clang/test/ExtractAPI/global_var_template_partial_spec.cpp b/clang/test/ExtractAPI/global_var_template_partial_spec.cpp
index e98076c..91084f25 100644
--- a/clang/test/ExtractAPI/global_var_template_partial_spec.cpp
+++ b/clang/test/ExtractAPI/global_var_template_partial_spec.cpp
@@ -2,7 +2,7 @@
// RUN: split-file %s %t
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang_cc1 -extract-api -triple arm64-apple-macosx \
+// RUN: %clang_cc1 -extract-api --pretty-sgf -triple arm64-apple-macosx \
// RUN: -x c++-header %t/input.h -o %t/output.json -verify
// Generator version is not consistent across test runs, normalize it.
diff --git a/clang/test/ExtractAPI/global_var_template_spec.cpp b/clang/test/ExtractAPI/global_var_template_spec.cpp
index cca2ab3..ff4d8d1 100644
--- a/clang/test/ExtractAPI/global_var_template_spec.cpp
+++ b/clang/test/ExtractAPI/global_var_template_spec.cpp
@@ -2,7 +2,7 @@
// RUN: split-file %s %t
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang_cc1 -extract-api -triple arm64-apple-macosx \
+// RUN: %clang_cc1 -extract-api --pretty-sgf -triple arm64-apple-macosx \
// RUN: -x c++-header %t/input.h -o %t/output.json -verify
// Generator version is not consistent across test runs, normalize it.
diff --git a/clang/test/ExtractAPI/known_files_only.c b/clang/test/ExtractAPI/known_files_only.c
index 68881aa..de1e786 100644
--- a/clang/test/ExtractAPI/known_files_only.c
+++ b/clang/test/ExtractAPI/known_files_only.c
@@ -1,17 +1,7 @@
// RUN: rm -rf %t
// RUN: split-file %s %t
-// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
-// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang -extract-api --product-name=GlobalRecord -target arm64-apple-macosx \
-// RUN: %t/input1.h -o %t/output.json | FileCheck -allow-empty %s
-
-// Generator version is not consistent across test runs, normalize it.
-// RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \
-// RUN: %t/output.json >> %t/output-normalized.json
-// RUN: diff %t/reference.output.json %t/output-normalized.json
-
-// CHECK-NOT: error:
-// CHECK-NOT: warning:
+// RUN: %clang_cc1 -extract-api --pretty-sgf --product-name=GlobalRecord -triple arm64-apple-macosx \
+// RUN: %t/input1.h -verify -o - | FileCheck %s
//--- input1.h
int num;
@@ -24,87 +14,6 @@ char not_emitted;
void foo(int);
struct Foo { int a; };
-//--- reference.output.json.in
-{
- "metadata": {
- "formatVersion": {
- "major": 0,
- "minor": 5,
- "patch": 3
- },
- "generator": "?"
- },
- "module": {
- "name": "GlobalRecord",
- "platform": {
- "architecture": "arm64",
- "operatingSystem": {
- "minimumVersion": {
- "major": 11,
- "minor": 0,
- "patch": 0
- },
- "name": "macosx"
- },
- "vendor": "apple"
- }
- },
- "relationships": [],
- "symbols": [
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "num"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "identifier": {
- "interfaceLanguage": "c",
- "precise": "c:@num"
- },
- "kind": {
- "displayName": "Global Variable",
- "identifier": "c.var"
- },
- "location": {
- "position": {
- "character": 4,
- "line": 0
- },
- "uri": "file://INPUT_DIR/input1.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "num"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "num"
- }
- ],
- "title": "num"
- },
- "pathComponents": [
- "num"
- ]
- }
- ]
-}
+// CHECK-NOT: input2.h
+
+// expected-no-diagnostics
diff --git a/clang/test/ExtractAPI/language.c b/clang/test/ExtractAPI/language.c
index fe98626..90832fd 100644
--- a/clang/test/ExtractAPI/language.c
+++ b/clang/test/ExtractAPI/language.c
@@ -7,11 +7,11 @@
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/objcpp.reference.output.json.in >> %t/objcpp.reference.output.json
-// RUN: %clang_cc1 -extract-api -x c-header -triple arm64-apple-macosx \
+// RUN: %clang_cc1 -extract-api --pretty-sgf -x c-header -triple arm64-apple-macosx \
// RUN: %t/c.h -o %t/c.output.json | FileCheck -allow-empty %s
-// RUN: %clang_cc1 -extract-api -x objective-c-header -triple arm64-apple-macosx \
+// RUN: %clang_cc1 -extract-api --pretty-sgf -x objective-c-header -triple arm64-apple-macosx \
// RUN: %t/objc.h -o %t/objc.output.json | FileCheck -allow-empty %s
-// RUN: %clang_cc1 -extract-api -x objective-c++-header -triple arm64-apple-macosx \
+// RUN: %clang_cc1 -extract-api --pretty-sgf -x objective-c++-header -triple arm64-apple-macosx \
// RUN: %t/objcpp.h -o %t/objcpp.output.json | FileCheck -allow-empty %s
// Generator version is not consistent across test runs, normalize it.
diff --git a/clang/test/ExtractAPI/macro_undefined.c b/clang/test/ExtractAPI/macro_undefined.c
index 1a4ed20..ec60f95 100644
--- a/clang/test/ExtractAPI/macro_undefined.c
+++ b/clang/test/ExtractAPI/macro_undefined.c
@@ -2,7 +2,7 @@
// RUN: split-file %s %t
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang -extract-api --product-name=Macros -target arm64-apple-macosx \
+// RUN: %clang -extract-api --pretty-sgf --product-name=Macros -target arm64-apple-macosx \
// RUN: -x objective-c-header %t/input.h -o %t/output.json | FileCheck -allow-empty %s
// Generator version is not consistent across test runs, normalize it.
diff --git a/clang/test/ExtractAPI/macros.c b/clang/test/ExtractAPI/macros.c
index d5807f6..10003fe 100644
--- a/clang/test/ExtractAPI/macros.c
+++ b/clang/test/ExtractAPI/macros.c
@@ -2,7 +2,7 @@
// RUN: split-file %s %t
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang -extract-api --product-name=Macros -target arm64-apple-macosx \
+// RUN: %clang -extract-api --pretty-sgf --product-name=Macros -target arm64-apple-macosx \
// RUN: -x objective-c-header %t/input.h -o %t/output.json | FileCheck -allow-empty %s
// Generator version is not consistent across test runs, normalize it.
diff --git a/clang/test/ExtractAPI/metadata_and_module.c b/clang/test/ExtractAPI/metadata_and_module.c
new file mode 100644
index 0000000..79574a2
--- /dev/null
+++ b/clang/test/ExtractAPI/metadata_and_module.c
@@ -0,0 +1,32 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -extract-api --pretty-sgf --product-name=module -triple arm64-apple-macosx -x c-header %s -o %t/module.symbols.json -verify
+
+// RUN: FileCheck %s --input-file %t/module.symbols.json --check-prefix METADATA
+// RUN: FileCheck %s --input-file %t/module.symbols.json --check-prefix MOD
+
+// expected-no-diagnostics
+
+// METADATA: "metadata": {
+// METADATA-NEXT: "formatVersion": {
+// METADATA-NEXT: "major":
+// METADATA-NEXT: "minor":
+// METADATA-NEXT: "patch":
+// METADATA-NEXT: },
+// METADATA-NEXT: "generator":
+// METADATA-NEXT: }
+
+// MOD: "module": {
+// MOD-NEXT: "name": "module",
+// MOD-NEXT: "platform": {
+// MOD-NEXT: "architecture": "arm64",
+// MOD-NEXT: "operatingSystem": {
+// MOD-NEXT: "minimumVersion": {
+// MOD-NEXT: "major":
+// MOD-NEXT: "minor":
+// MOD-NEXT: "patch":
+// MOD-NEXT: },
+// MOD-NEXT: "name": "macosx"
+// MOD-NEXT: },
+// MOD-NEXT: "vendor": "apple"
+// MOD-NEXT: }
+// MOD-NEXT: }
diff --git a/clang/test/ExtractAPI/method_template.cpp b/clang/test/ExtractAPI/method_template.cpp
index 8d83233..714f9ca 100644
--- a/clang/test/ExtractAPI/method_template.cpp
+++ b/clang/test/ExtractAPI/method_template.cpp
@@ -2,7 +2,7 @@
// RUN: split-file %s %t
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang_cc1 -extract-api -triple arm64-apple-macosx \
+// RUN: %clang_cc1 -extract-api --pretty-sgf -triple arm64-apple-macosx \
// RUN: -x c++-header %t/input.h -o %t/output.json -verify
// Generator version is not consistent across test runs, normalize it.
diff --git a/clang/test/ExtractAPI/method_template_spec.cpp b/clang/test/ExtractAPI/method_template_spec.cpp
index 706d99d..8eaffde 100644
--- a/clang/test/ExtractAPI/method_template_spec.cpp
+++ b/clang/test/ExtractAPI/method_template_spec.cpp
@@ -2,7 +2,7 @@
// RUN: split-file %s %t
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang_cc1 -extract-api -triple arm64-apple-macosx \
+// RUN: %clang_cc1 -extract-api --pretty-sgf -triple arm64-apple-macosx \
// RUN: -x c++-header %t/input.h -o %t/output.json -verify
// Generator version is not consistent across test runs, normalize it.
diff --git a/clang/test/ExtractAPI/methods.cpp b/clang/test/ExtractAPI/methods.cpp
index 8b024a8..412c0bb 100644
--- a/clang/test/ExtractAPI/methods.cpp
+++ b/clang/test/ExtractAPI/methods.cpp
@@ -1,467 +1,221 @@
// RUN: rm -rf %t
-// RUN: split-file %s %t
-// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
-// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang_cc1 -extract-api -triple arm64-apple-macosx \
-// RUN: -x c++-header %t/input.h -o %t/output.json -verify
+// RUN: %clang_cc1 -extract-api --pretty-sgf --emit-sgf-symbol-labels-for-testing \
+// RUN: -triple arm64-apple-macosx -x c++-header %s -o %t/output.symbols.json -verify
-// Generator version is not consistent across test runs, normalize it.
-// RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \
-// RUN: %t/output.json >> %t/output-normalized.json
-// RUN: diff %t/reference.output.json %t/output-normalized.json
-
-//--- input.h
class Foo {
+ // RUN: FileCheck %s --input-file %t/output.symbols.json --check-prefix GETCOUNT
int getCount();
+ // GETCOUNT: "!testRelLabel": "memberOf $ c:@S@Foo@F@getCount# $ c:@S@Foo"
+ // GETCOUNT-LABEL: "!testLabel": "c:@S@Foo@F@getCount#"
+ // GETCOUNT: "accessLevel": "private",
+ // GETCOUNT: "declarationFragments": [
+ // GETCOUNT-NEXT: {
+ // GETCOUNT-NEXT: "kind": "typeIdentifier",
+ // GETCOUNT-NEXT: "preciseIdentifier": "c:I",
+ // GETCOUNT-NEXT: "spelling": "int"
+ // GETCOUNT-NEXT: },
+ // GETCOUNT-NEXT: {
+ // GETCOUNT-NEXT: "kind": "text",
+ // GETCOUNT-NEXT: "spelling": " "
+ // GETCOUNT-NEXT: },
+ // GETCOUNT-NEXT: {
+ // GETCOUNT-NEXT: "kind": "identifier",
+ // GETCOUNT-NEXT: "spelling": "getCount"
+ // GETCOUNT-NEXT: },
+ // GETCOUNT-NEXT: {
+ // GETCOUNT-NEXT: "kind": "text",
+ // GETCOUNT-NEXT: "spelling": "();"
+ // GETCOUNT-NEXT: }
+ // GETCOUNT-NEXT: ],
+ // GETCOUNT: "functionSignature": {
+ // GETCOUNT-NEXT: "returns": [
+ // GETCOUNT-NEXT: {
+ // GETCOUNT-NEXT: "kind": "typeIdentifier",
+ // GETCOUNT-NEXT: "preciseIdentifier": "c:I",
+ // GETCOUNT-NEXT: "spelling": "int"
+ // GETCOUNT-NEXT: }
+ // GETCOUNT-NEXT: ]
+ // GETCOUNT-NEXT: },
+ // GETCOUNT: "displayName": "Instance Method",
+ // GETCOUNT-NEXT: "identifier": "c++.method"
+ // GETCOUNT: "title": "getCount"
+ // GETCOUNT: "pathComponents": [
+ // GETCOUNT-NEXT: "Foo",
+ // GETCOUNT-NEXT: "getCount"
+ // GETCOUNT-NEXT: ]
+ // RUN: FileCheck %s --input-file %t/output.symbols.json --check-prefix SETL
void setLength(int length) noexcept;
+ // SETL: "!testRelLabel": "memberOf $ c:@S@Foo@F@setLength#I# $ c:@S@Foo"
+ // SETL-LABEL: "!testLabel": "c:@S@Foo@F@setLength#I#"
+ // SETL: "declarationFragments": [
+ // SETL-NEXT: {
+ // SETL-NEXT: "kind": "typeIdentifier",
+ // SETL-NEXT: "preciseIdentifier": "c:v",
+ // SETL-NEXT: "spelling": "void"
+ // SETL-NEXT: },
+ // SETL-NEXT: {
+ // SETL-NEXT: "kind": "text",
+ // SETL-NEXT: "spelling": " "
+ // SETL-NEXT: },
+ // SETL-NEXT: {
+ // SETL-NEXT: "kind": "identifier",
+ // SETL-NEXT: "spelling": "setLength"
+ // SETL-NEXT: },
+ // SETL-NEXT: {
+ // SETL-NEXT: "kind": "text",
+ // SETL-NEXT: "spelling": "("
+ // SETL-NEXT: },
+ // SETL-NEXT: {
+ // SETL-NEXT: "kind": "typeIdentifier",
+ // SETL-NEXT: "preciseIdentifier": "c:I",
+ // SETL-NEXT: "spelling": "int"
+ // SETL-NEXT: },
+ // SETL-NEXT: {
+ // SETL-NEXT: "kind": "text",
+ // SETL-NEXT: "spelling": " "
+ // SETL-NEXT: },
+ // SETL-NEXT: {
+ // SETL-NEXT: "kind": "internalParam",
+ // SETL-NEXT: "spelling": "length"
+ // SETL-NEXT: },
+ // SETL-NEXT: {
+ // SETL-NEXT: "kind": "text",
+ // SETL-NEXT: "spelling": ")"
+ // SETL-NEXT: },
+ // SETL-NEXT: {
+ // SETL-NEXT: "kind": "text",
+ // SETL-NEXT: "spelling": " "
+ // SETL-NEXT: },
+ // SETL-NEXT: {
+ // SETL-NEXT: "kind": "keyword",
+ // SETL-NEXT: "spelling": "noexcept"
+ // SETL-NEXT: },
+ // SETL-NEXT: {
+ // SETL-NEXT: "kind": "text",
+ // SETL-NEXT: "spelling": ";"
+ // SETL-NEXT: }
+ // SETL-NEXT: ],
+ // SETL: "functionSignature": {
+ // SETL-NEXT: "parameters": [
+ // SETL-NEXT: {
+ // SETL-NEXT: "declarationFragments": [
+ // SETL-NEXT: {
+ // SETL-NEXT: "kind": "typeIdentifier",
+ // SETL-NEXT: "preciseIdentifier": "c:I",
+ // SETL-NEXT: "spelling": "int"
+ // SETL-NEXT: },
+ // SETL-NEXT: {
+ // SETL-NEXT: "kind": "text",
+ // SETL-NEXT: "spelling": " "
+ // SETL-NEXT: },
+ // SETL-NEXT: {
+ // SETL-NEXT: "kind": "internalParam",
+ // SETL-NEXT: "spelling": "length"
+ // SETL-NEXT: }
+ // SETL-NEXT: ],
+ // SETL-NEXT: "name": "length"
+ // SETL-NEXT: }
+ // SETL-NEXT: ],
+ // SETL-NEXT: "returns": [
+ // SETL-NEXT: {
+ // SETL-NEXT: "kind": "typeIdentifier",
+ // SETL-NEXT: "preciseIdentifier": "c:v",
+ // SETL-NEXT: "spelling": "void"
+ // SETL-NEXT: }
+ // SETL-NEXT: ]
+ // SETL-NEXT: },
public:
+ // RUN: FileCheck %s --input-file %t/output.symbols.json --check-prefix GETFOO
static double getFoo();
+ // GETFOO: "!testRelLabel": "memberOf $ c:@S@Foo@F@getFoo#S $ c:@S@Foo"
+
+ // GETFOO-LABEL: "!testLabel": "c:@S@Foo@F@getFoo#S"
+ // GETFOO: "accessLevel": "public",
+ // GETFOO: "declarationFragments": [
+ // GETFOO-NEXT: {
+ // GETFOO-NEXT: "kind": "keyword",
+ // GETFOO-NEXT: "spelling": "static"
+ // GETFOO-NEXT: },
+ // GETFOO-NEXT: {
+ // GETFOO-NEXT: "kind": "text",
+ // GETFOO-NEXT: "spelling": " "
+ // GETFOO-NEXT: },
+ // GETFOO-NEXT: {
+ // GETFOO-NEXT: "kind": "typeIdentifier",
+ // GETFOO-NEXT: "preciseIdentifier": "c:d",
+ // GETFOO-NEXT: "spelling": "double"
+ // GETFOO-NEXT: },
+ // GETFOO-NEXT: {
+ // GETFOO-NEXT: "kind": "text",
+ // GETFOO-NEXT: "spelling": " "
+ // GETFOO-NEXT: },
+ // GETFOO-NEXT: {
+ // GETFOO-NEXT: "kind": "identifier",
+ // GETFOO-NEXT: "spelling": "getFoo"
+ // GETFOO-NEXT: },
+ // GETFOO-NEXT: {
+ // GETFOO-NEXT: "kind": "text",
+ // GETFOO-NEXT: "spelling": "();"
+ // GETFOO-NEXT: }
+ // GETFOO-NEXT: ],
+ // GETFOO: "functionSignature": {
+ // GETFOO-NEXT: "returns": [
+ // GETFOO-NEXT: {
+ // GETFOO-NEXT: "kind": "typeIdentifier",
+ // GETFOO-NEXT: "preciseIdentifier": "c:d",
+ // GETFOO-NEXT: "spelling": "double"
+ // GETFOO-NEXT: }
+ // GETFOO-NEXT: ]
+ // GETFOO-NEXT: },
+ // GETFOO: "kind": {
+ // GETFOO-NEXT: "displayName": "Static Method",
+ // GETFOO-NEXT: "identifier": "c++.type.method"
+ // GETFOO-NEXT: },
protected:
+ // RUN: FileCheck %s --input-file %t/output.symbols.json --check-prefix GETBAR
constexpr int getBar() const;
+ // GETBAR: "!testRelLabel": "memberOf $ c:@S@Foo@F@getBar#1 $ c:@S@Foo"
+
+ // GETBAR-LABEL: "!testLabel": "c:@S@Foo@F@getBar#1"
+ // GETBAR: "accessLevel": "protected"
+ // GETBAR: "declarationFragments": [
+ // GETBAR-NEXT: {
+ // GETBAR-NEXT: "kind": "keyword",
+ // GETBAR-NEXT: "spelling": "constexpr"
+ // GETBAR-NEXT: },
+ // GETBAR-NEXT: {
+ // GETBAR-NEXT: "kind": "text",
+ // GETBAR-NEXT: "spelling": " "
+ // GETBAR-NEXT: },
+ // GETBAR-NEXT: {
+ // GETBAR-NEXT: "kind": "typeIdentifier",
+ // GETBAR-NEXT: "preciseIdentifier": "c:I",
+ // GETBAR-NEXT: "spelling": "int"
+ // GETBAR-NEXT: },
+ // GETBAR-NEXT: {
+ // GETBAR-NEXT: "kind": "text",
+ // GETBAR-NEXT: "spelling": " "
+ // GETBAR-NEXT: },
+ // GETBAR-NEXT: {
+ // GETBAR-NEXT: "kind": "identifier",
+ // GETBAR-NEXT: "spelling": "getBar"
+ // GETBAR-NEXT: },
+ // GETBAR-NEXT: {
+ // GETBAR-NEXT: "kind": "text",
+ // GETBAR-NEXT: "spelling": "() "
+ // GETBAR-NEXT: },
+ // GETBAR-NEXT: {
+ // GETBAR-NEXT: "kind": "keyword",
+ // GETBAR-NEXT: "spelling": "const"
+ // GETBAR-NEXT: },
+ // GETBAR-NEXT: {
+ // GETBAR-NEXT: "kind": "text",
+ // GETBAR-NEXT: "spelling": ";"
+ // GETBAR-NEXT: }
+ // GETBAR-NEXT: ],
};
-/// expected-no-diagnostics
-//--- reference.output.json.in
-{
- "metadata": {
- "formatVersion": {
- "major": 0,
- "minor": 5,
- "patch": 3
- },
- "generator": "?"
- },
- "module": {
- "name": "",
- "platform": {
- "architecture": "arm64",
- "operatingSystem": {
- "minimumVersion": {
- "major": 11,
- "minor": 0,
- "patch": 0
- },
- "name": "macosx"
- },
- "vendor": "apple"
- }
- },
- "relationships": [
- {
- "kind": "memberOf",
- "source": "c:@S@Foo@F@getCount#",
- "target": "c:@S@Foo",
- "targetFallback": "Foo"
- },
- {
- "kind": "memberOf",
- "source": "c:@S@Foo@F@setLength#I#",
- "target": "c:@S@Foo",
- "targetFallback": "Foo"
- },
- {
- "kind": "memberOf",
- "source": "c:@S@Foo@F@getBar#1",
- "target": "c:@S@Foo",
- "targetFallback": "Foo"
- },
- {
- "kind": "memberOf",
- "source": "c:@S@Foo@F@getFoo#S",
- "target": "c:@S@Foo",
- "targetFallback": "Foo"
- }
- ],
- "symbols": [
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "class"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "Foo"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "identifier": {
- "interfaceLanguage": "c++",
- "precise": "c:@S@Foo"
- },
- "kind": {
- "displayName": "Class",
- "identifier": "c++.class"
- },
- "location": {
- "position": {
- "character": 6,
- "line": 0
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "Foo"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "Foo"
- }
- ],
- "title": "Foo"
- },
- "pathComponents": [
- "Foo"
- ]
- },
- {
- "accessLevel": "private",
- "declarationFragments": [
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "getCount"
- },
- {
- "kind": "text",
- "spelling": "();"
- }
- ],
- "functionSignature": {
- "returns": [
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- }
- ]
- },
- "identifier": {
- "interfaceLanguage": "c++",
- "precise": "c:@S@Foo@F@getCount#"
- },
- "kind": {
- "displayName": "Instance Method",
- "identifier": "c++.method"
- },
- "location": {
- "position": {
- "character": 6,
- "line": 1
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "getCount"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "getCount"
- }
- ],
- "title": "getCount"
- },
- "pathComponents": [
- "Foo",
- "getCount"
- ]
- },
- {
- "accessLevel": "private",
- "declarationFragments": [
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:v",
- "spelling": "void"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "setLength"
- },
- {
- "kind": "text",
- "spelling": "("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "internalParam",
- "spelling": "length"
- },
- {
- "kind": "text",
- "spelling": ")"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "keyword",
- "spelling": "noexcept"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "functionSignature": {
- "parameters": [
- {
- "declarationFragments": [
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "internalParam",
- "spelling": "length"
- }
- ],
- "name": "length"
- }
- ],
- "returns": [
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:v",
- "spelling": "void"
- }
- ]
- },
- "identifier": {
- "interfaceLanguage": "c++",
- "precise": "c:@S@Foo@F@setLength#I#"
- },
- "kind": {
- "displayName": "Instance Method",
- "identifier": "c++.method"
- },
- "location": {
- "position": {
- "character": 7,
- "line": 3
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "setLength"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "setLength"
- }
- ],
- "title": "setLength"
- },
- "pathComponents": [
- "Foo",
- "setLength"
- ]
- },
- {
- "accessLevel": "protected",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "constexpr"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "getBar"
- },
- {
- "kind": "text",
- "spelling": "() "
- },
- {
- "kind": "keyword",
- "spelling": "const"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "functionSignature": {
- "returns": [
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- }
- ]
- },
- "identifier": {
- "interfaceLanguage": "c++",
- "precise": "c:@S@Foo@F@getBar#1"
- },
- "kind": {
- "displayName": "Instance Method",
- "identifier": "c++.method"
- },
- "location": {
- "position": {
- "character": 16,
- "line": 9
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "getBar"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "getBar"
- }
- ],
- "title": "getBar"
- },
- "pathComponents": [
- "Foo",
- "getBar"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "static"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:d",
- "spelling": "double"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "getFoo"
- },
- {
- "kind": "text",
- "spelling": "();"
- }
- ],
- "functionSignature": {
- "returns": [
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:d",
- "spelling": "double"
- }
- ]
- },
- "identifier": {
- "interfaceLanguage": "c++",
- "precise": "c:@S@Foo@F@getFoo#S"
- },
- "kind": {
- "displayName": "Static Method",
- "identifier": "c++.type.method"
- },
- "location": {
- "position": {
- "character": 16,
- "line": 6
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "getFoo"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "getFoo"
- }
- ],
- "title": "getFoo"
- },
- "pathComponents": [
- "Foo",
- "getFoo"
- ]
- }
- ]
-}
+// expected-no-diagnostics
diff --git a/clang/test/ExtractAPI/multiple_inheritance.cpp b/clang/test/ExtractAPI/multiple_inheritance.cpp
index a1f069b..7d49cf4 100644
--- a/clang/test/ExtractAPI/multiple_inheritance.cpp
+++ b/clang/test/ExtractAPI/multiple_inheritance.cpp
@@ -3,7 +3,7 @@
// RUN: split-file %s %t
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang_cc1 -extract-api -triple arm64-apple-macosx \
+// RUN: %clang_cc1 -extract-api --pretty-sgf -triple arm64-apple-macosx \
// RUN: -x c++-header %t/input.h -o %t/output.json -verify
// Generator version is not consistent across test runs, normalize it.
diff --git a/clang/test/ExtractAPI/namespace.cpp b/clang/test/ExtractAPI/namespace.cpp
index e0c36dd..73e0728 100644
--- a/clang/test/ExtractAPI/namespace.cpp
+++ b/clang/test/ExtractAPI/namespace.cpp
@@ -2,7 +2,7 @@
// RUN: split-file %s %t
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang_cc1 -std=c++20 -extract-api -triple arm64-apple-macosx \
+// RUN: %clang_cc1 -extract-api --pretty-sgf -triple arm64-apple-macosx \
// RUN: -x c++-header %t/input.h -o %t/output.json -verify
// Generator version is not consistent across test runs, normalize it.
diff --git a/clang/test/ExtractAPI/nested_namespaces.cpp b/clang/test/ExtractAPI/nested_namespaces.cpp
index bd13ef9..c6912cf 100644
--- a/clang/test/ExtractAPI/nested_namespaces.cpp
+++ b/clang/test/ExtractAPI/nested_namespaces.cpp
@@ -2,7 +2,7 @@
// RUN: split-file %s %t
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang_cc1 -std=c++20 -extract-api -triple arm64-apple-macosx \
+// RUN: %clang_cc1 -extract-api --pretty-sgf -triple arm64-apple-macosx \
// RUN: -x c++-header %t/input.h -o %t/output.json -verify
// Generator version is not consistent across test runs, normalize it.
diff --git a/clang/test/ExtractAPI/objc_block.m b/clang/test/ExtractAPI/objc_block.m
index a7a4f56..4a4335e 100644
--- a/clang/test/ExtractAPI/objc_block.m
+++ b/clang/test/ExtractAPI/objc_block.m
@@ -1,965 +1,630 @@
// RUN: rm -rf %t
-// RUN: split-file %s %t
-// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
-// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang_cc1 -extract-api -fblocks -triple arm64-apple-macosx \
-// RUN: -x objective-c-header %t/input.h -o %t/output.json -verify
+// RUN: %clang_cc1 -extract-api --pretty-sgf --emit-sgf-symbol-labels-for-testing \
+// RUN: -fblocks -triple arm64-apple-macosx -x objective-c-header %s -o %t/output.symbols.json -verify
-// Generator version is not consistent across test runs, normalize it.
-// RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \
-// RUN: %t/output.json >> %t/output-normalized.json
-// RUN: diff %t/reference.output.json %t/output-normalized.json
-
-//--- input.h
@interface Foo
+// RUN: FileCheck %s --input-file %t/output.symbols.json --check-prefix NOPARAM
-(void)methodBlockNoParam:(void (^)())block;
+// NOPARAM-LABEL: "!testLabel": "c:objc(cs)Foo(im)methodBlockNoParam:"
+// NOPARAM: "declarationFragments": [
+// NOPARAM-NEXT: {
+// NOPARAM-NEXT: "kind": "text",
+// NOPARAM-NEXT: "spelling": "- ("
+// NOPARAM-NEXT: },
+// NOPARAM-NEXT: {
+// NOPARAM-NEXT: "kind": "typeIdentifier",
+// NOPARAM-NEXT: "preciseIdentifier": "c:v",
+// NOPARAM-NEXT: "spelling": "void"
+// NOPARAM-NEXT: },
+// NOPARAM-NEXT: {
+// NOPARAM-NEXT: "kind": "text",
+// NOPARAM-NEXT: "spelling": ") "
+// NOPARAM-NEXT: },
+// NOPARAM-NEXT: {
+// NOPARAM-NEXT: "kind": "identifier",
+// NOPARAM-NEXT: "spelling": "methodBlockNoParam:"
+// NOPARAM-NEXT: },
+// NOPARAM-NEXT: {
+// NOPARAM-NEXT: "kind": "text",
+// NOPARAM-NEXT: "spelling": "("
+// NOPARAM-NEXT: },
+// NOPARAM-NEXT: {
+// NOPARAM-NEXT: "kind": "typeIdentifier",
+// NOPARAM-NEXT: "preciseIdentifier": "c:v",
+// NOPARAM-NEXT: "spelling": "void"
+// NOPARAM-NEXT: },
+// NOPARAM-NEXT: {
+// NOPARAM-NEXT: "kind": "text",
+// NOPARAM-NEXT: "spelling": " (^"
+// NOPARAM-NEXT: },
+// NOPARAM-NEXT: {
+// NOPARAM-NEXT: "kind": "text",
+// NOPARAM-NEXT: "spelling": ")()) "
+// NOPARAM-NEXT: },
+// NOPARAM-NEXT: {
+// NOPARAM-NEXT: "kind": "internalParam",
+// NOPARAM-NEXT: "spelling": "block"
+// NOPARAM-NEXT: },
+// NOPARAM-NEXT: {
+// NOPARAM-NEXT: "kind": "text",
+// NOPARAM-NEXT: "spelling": ";"
+// NOPARAM-NEXT: }
+// NOPARAM-NEXT: ],
+// NOPARAM: "functionSignature": {
+// NOPARAM-NEXT: "parameters": [
+// NOPARAM-NEXT: {
+// NOPARAM-NEXT: "declarationFragments": [
+// NOPARAM-NEXT: {
+// NOPARAM-NEXT: "kind": "text",
+// NOPARAM-NEXT: "spelling": "("
+// NOPARAM-NEXT: },
+// NOPARAM-NEXT: {
+// NOPARAM-NEXT: "kind": "typeIdentifier",
+// NOPARAM-NEXT: "preciseIdentifier": "c:v",
+// NOPARAM-NEXT: "spelling": "void"
+// NOPARAM-NEXT: },
+// NOPARAM-NEXT: {
+// NOPARAM-NEXT: "kind": "text",
+// NOPARAM-NEXT: "spelling": " (^"
+// NOPARAM-NEXT: },
+// NOPARAM-NEXT: {
+// NOPARAM-NEXT: "kind": "text",
+// NOPARAM-NEXT: "spelling": ")()) "
+// NOPARAM-NEXT: },
+// NOPARAM-NEXT: {
+// NOPARAM-NEXT: "kind": "internalParam",
+// NOPARAM-NEXT: "spelling": "block"
+// NOPARAM-NEXT: }
+// NOPARAM-NEXT: ],
+// NOPARAM-NEXT: "name": "block"
+// NOPARAM-NEXT: }
+// NOPARAM-NEXT: ],
+// NOPARAM-NEXT: "returns": [
+// NOPARAM-NEXT: {
+// NOPARAM-NEXT: "kind": "typeIdentifier",
+// NOPARAM-NEXT: "preciseIdentifier": "c:v",
+// NOPARAM-NEXT: "spelling": "void"
+// NOPARAM-NEXT: }
+// NOPARAM-NEXT: ]
+// NOPARAM-NEXT: }
+
+// RUN: FileCheck %s --input-file %t/output.symbols.json --check-prefix PARAM
-(void)methodBlockWithParam:(int (^)(int foo))block;
+// PARAM-LABEL: "!testLabel": "c:objc(cs)Foo(im)methodBlockWithParam:"
+// PARAM: "declarationFragments": [
+// PARAM-NEXT: {
+// PARAM-NEXT: "kind": "text",
+// PARAM-NEXT: "spelling": "- ("
+// PARAM-NEXT: },
+// PARAM-NEXT: {
+// PARAM-NEXT: "kind": "typeIdentifier",
+// PARAM-NEXT: "preciseIdentifier": "c:v",
+// PARAM-NEXT: "spelling": "void"
+// PARAM-NEXT: },
+// PARAM-NEXT: {
+// PARAM-NEXT: "kind": "text",
+// PARAM-NEXT: "spelling": ") "
+// PARAM-NEXT: },
+// PARAM-NEXT: {
+// PARAM-NEXT: "kind": "identifier",
+// PARAM-NEXT: "spelling": "methodBlockWithParam:"
+// PARAM-NEXT: },
+// PARAM-NEXT: {
+// PARAM-NEXT: "kind": "text",
+// PARAM-NEXT: "spelling": "("
+// PARAM-NEXT: },
+// PARAM-NEXT: {
+// PARAM-NEXT: "kind": "typeIdentifier",
+// PARAM-NEXT: "preciseIdentifier": "c:I",
+// PARAM-NEXT: "spelling": "int"
+// PARAM-NEXT: },
+// PARAM-NEXT: {
+// PARAM-NEXT: "kind": "text",
+// PARAM-NEXT: "spelling": " (^"
+// PARAM-NEXT: },
+// PARAM-NEXT: {
+// PARAM-NEXT: "kind": "text",
+// PARAM-NEXT: "spelling": ")("
+// PARAM-NEXT: },
+// PARAM-NEXT: {
+// PARAM-NEXT: "kind": "typeIdentifier",
+// PARAM-NEXT: "preciseIdentifier": "c:I",
+// PARAM-NEXT: "spelling": "int"
+// PARAM-NEXT: },
+// PARAM-NEXT: {
+// PARAM-NEXT: "kind": "text",
+// PARAM-NEXT: "spelling": " "
+// PARAM-NEXT: },
+// PARAM-NEXT: {
+// PARAM-NEXT: "kind": "internalParam",
+// PARAM-NEXT: "spelling": "foo"
+// PARAM-NEXT: },
+// PARAM-NEXT: {
+// PARAM-NEXT: "kind": "text",
+// PARAM-NEXT: "spelling": ")) "
+// PARAM-NEXT: },
+// PARAM-NEXT: {
+// PARAM-NEXT: "kind": "internalParam",
+// PARAM-NEXT: "spelling": "block"
+// PARAM-NEXT: },
+// PARAM-NEXT: {
+// PARAM-NEXT: "kind": "text",
+// PARAM-NEXT: "spelling": ";"
+// PARAM-NEXT: }
+// PARAM-NEXT: ],
+// PARAM: "functionSignature": {
+// PARAM-NEXT: "parameters": [
+// PARAM-NEXT: {
+// PARAM-NEXT: "declarationFragments": [
+// PARAM-NEXT: {
+// PARAM-NEXT: "kind": "text",
+// PARAM-NEXT: "spelling": "("
+// PARAM-NEXT: },
+// PARAM-NEXT: {
+// PARAM-NEXT: "kind": "typeIdentifier",
+// PARAM-NEXT: "preciseIdentifier": "c:I",
+// PARAM-NEXT: "spelling": "int"
+// PARAM-NEXT: },
+// PARAM-NEXT: {
+// PARAM-NEXT: "kind": "text",
+// PARAM-NEXT: "spelling": " (^"
+// PARAM-NEXT: },
+// PARAM-NEXT: {
+// PARAM-NEXT: "kind": "text",
+// PARAM-NEXT: "spelling": ")("
+// PARAM-NEXT: },
+// PARAM-NEXT: {
+// PARAM-NEXT: "kind": "typeIdentifier",
+// PARAM-NEXT: "preciseIdentifier": "c:I",
+// PARAM-NEXT: "spelling": "int"
+// PARAM-NEXT: },
+// PARAM-NEXT: {
+// PARAM-NEXT: "kind": "text",
+// PARAM-NEXT: "spelling": " "
+// PARAM-NEXT: },
+// PARAM-NEXT: {
+// PARAM-NEXT: "kind": "internalParam",
+// PARAM-NEXT: "spelling": "foo"
+// PARAM-NEXT: },
+// PARAM-NEXT: {
+// PARAM-NEXT: "kind": "text",
+// PARAM-NEXT: "spelling": ")) "
+// PARAM-NEXT: },
+// PARAM-NEXT: {
+// PARAM-NEXT: "kind": "internalParam",
+// PARAM-NEXT: "spelling": "block"
+// PARAM-NEXT: }
+// PARAM-NEXT: ],
+// PARAM-NEXT: "name": "block"
+// PARAM-NEXT: }
+// PARAM-NEXT: ],
+// PARAM-NEXT: "returns": [
+// PARAM-NEXT: {
+// PARAM-NEXT: "kind": "typeIdentifier",
+// PARAM-NEXT: "preciseIdentifier": "c:v",
+// PARAM-NEXT: "spelling": "void"
+// PARAM-NEXT: }
+// PARAM-NEXT: ]
+// PARAM-NEXT: }
+
+// RUN: FileCheck %s --input-file %t/output.symbols.json --check-prefix MULTIPARAM
-(void)methodBlockWithMultipleParam:(int (^)(int foo, unsigned baz))block;
+// MULTIPARAM-LABEL: "!testLabel": "c:objc(cs)Foo(im)methodBlockWithMultipleParam:"
+// MULTIPARAM: "declarationFragments": [
+// MULTIPARAM-NEXT: {
+// MULTIPARAM-NEXT: "kind": "text",
+// MULTIPARAM-NEXT: "spelling": "- ("
+// MULTIPARAM-NEXT: },
+// MULTIPARAM-NEXT: {
+// MULTIPARAM-NEXT: "kind": "typeIdentifier",
+// MULTIPARAM-NEXT: "preciseIdentifier": "c:v",
+// MULTIPARAM-NEXT: "spelling": "void"
+// MULTIPARAM-NEXT: },
+// MULTIPARAM-NEXT: {
+// MULTIPARAM-NEXT: "kind": "text",
+// MULTIPARAM-NEXT: "spelling": ") "
+// MULTIPARAM-NEXT: },
+// MULTIPARAM-NEXT: {
+// MULTIPARAM-NEXT: "kind": "identifier",
+// MULTIPARAM-NEXT: "spelling": "methodBlockWithMultipleParam:"
+// MULTIPARAM-NEXT: },
+// MULTIPARAM-NEXT: {
+// MULTIPARAM-NEXT: "kind": "text",
+// MULTIPARAM-NEXT: "spelling": "("
+// MULTIPARAM-NEXT: },
+// MULTIPARAM-NEXT: {
+// MULTIPARAM-NEXT: "kind": "typeIdentifier",
+// MULTIPARAM-NEXT: "preciseIdentifier": "c:I",
+// MULTIPARAM-NEXT: "spelling": "int"
+// MULTIPARAM-NEXT: },
+// MULTIPARAM-NEXT: {
+// MULTIPARAM-NEXT: "kind": "text",
+// MULTIPARAM-NEXT: "spelling": " (^"
+// MULTIPARAM-NEXT: },
+// MULTIPARAM-NEXT: {
+// MULTIPARAM-NEXT: "kind": "text",
+// MULTIPARAM-NEXT: "spelling": ")("
+// MULTIPARAM-NEXT: },
+// MULTIPARAM-NEXT: {
+// MULTIPARAM-NEXT: "kind": "typeIdentifier",
+// MULTIPARAM-NEXT: "preciseIdentifier": "c:I",
+// MULTIPARAM-NEXT: "spelling": "int"
+// MULTIPARAM-NEXT: },
+// MULTIPARAM-NEXT: {
+// MULTIPARAM-NEXT: "kind": "text",
+// MULTIPARAM-NEXT: "spelling": " "
+// MULTIPARAM-NEXT: },
+// MULTIPARAM-NEXT: {
+// MULTIPARAM-NEXT: "kind": "internalParam",
+// MULTIPARAM-NEXT: "spelling": "foo"
+// MULTIPARAM-NEXT: },
+// MULTIPARAM-NEXT: {
+// MULTIPARAM-NEXT: "kind": "text",
+// MULTIPARAM-NEXT: "spelling": ", "
+// MULTIPARAM-NEXT: },
+// MULTIPARAM-NEXT: {
+// MULTIPARAM-NEXT: "kind": "typeIdentifier",
+// MULTIPARAM-NEXT: "preciseIdentifier": "c:i",
+// MULTIPARAM-NEXT: "spelling": "unsigned int"
+// MULTIPARAM-NEXT: },
+// MULTIPARAM-NEXT: {
+// MULTIPARAM-NEXT: "kind": "text",
+// MULTIPARAM-NEXT: "spelling": " "
+// MULTIPARAM-NEXT: },
+// MULTIPARAM-NEXT: {
+// MULTIPARAM-NEXT: "kind": "internalParam",
+// MULTIPARAM-NEXT: "spelling": "baz"
+// MULTIPARAM-NEXT: },
+// MULTIPARAM-NEXT: {
+// MULTIPARAM-NEXT: "kind": "text",
+// MULTIPARAM-NEXT: "spelling": ")) "
+// MULTIPARAM-NEXT: },
+// MULTIPARAM-NEXT: {
+// MULTIPARAM-NEXT: "kind": "internalParam",
+// MULTIPARAM-NEXT: "spelling": "block"
+// MULTIPARAM-NEXT: },
+// MULTIPARAM-NEXT: {
+// MULTIPARAM-NEXT: "kind": "text",
+// MULTIPARAM-NEXT: "spelling": ";"
+// MULTIPARAM-NEXT: }
+// MULTIPARAM-NEXT: ],
+// MULTIPARAM: "functionSignature": {
+// MULTIPARAM-NEXT: "parameters": [
+// MULTIPARAM-NEXT: {
+// MULTIPARAM-NEXT: "declarationFragments": [
+// MULTIPARAM-NEXT: {
+// MULTIPARAM-NEXT: "kind": "text",
+// MULTIPARAM-NEXT: "spelling": "("
+// MULTIPARAM-NEXT: },
+// MULTIPARAM-NEXT: {
+// MULTIPARAM-NEXT: "kind": "typeIdentifier",
+// MULTIPARAM-NEXT: "preciseIdentifier": "c:I",
+// MULTIPARAM-NEXT: "spelling": "int"
+// MULTIPARAM-NEXT: },
+// MULTIPARAM-NEXT: {
+// MULTIPARAM-NEXT: "kind": "text",
+// MULTIPARAM-NEXT: "spelling": " (^"
+// MULTIPARAM-NEXT: },
+// MULTIPARAM-NEXT: {
+// MULTIPARAM-NEXT: "kind": "text",
+// MULTIPARAM-NEXT: "spelling": ")("
+// MULTIPARAM-NEXT: },
+// MULTIPARAM-NEXT: {
+// MULTIPARAM-NEXT: "kind": "typeIdentifier",
+// MULTIPARAM-NEXT: "preciseIdentifier": "c:I",
+// MULTIPARAM-NEXT: "spelling": "int"
+// MULTIPARAM-NEXT: },
+// MULTIPARAM-NEXT: {
+// MULTIPARAM-NEXT: "kind": "text",
+// MULTIPARAM-NEXT: "spelling": " "
+// MULTIPARAM-NEXT: },
+// MULTIPARAM-NEXT: {
+// MULTIPARAM-NEXT: "kind": "internalParam",
+// MULTIPARAM-NEXT: "spelling": "foo"
+// MULTIPARAM-NEXT: },
+// MULTIPARAM-NEXT: {
+// MULTIPARAM-NEXT: "kind": "text",
+// MULTIPARAM-NEXT: "spelling": ", "
+// MULTIPARAM-NEXT: },
+// MULTIPARAM-NEXT: {
+// MULTIPARAM-NEXT: "kind": "typeIdentifier",
+// MULTIPARAM-NEXT: "preciseIdentifier": "c:i",
+// MULTIPARAM-NEXT: "spelling": "unsigned int"
+// MULTIPARAM-NEXT: },
+// MULTIPARAM-NEXT: {
+// MULTIPARAM-NEXT: "kind": "text",
+// MULTIPARAM-NEXT: "spelling": " "
+// MULTIPARAM-NEXT: },
+// MULTIPARAM-NEXT: {
+// MULTIPARAM-NEXT: "kind": "internalParam",
+// MULTIPARAM-NEXT: "spelling": "baz"
+// MULTIPARAM-NEXT: },
+// MULTIPARAM-NEXT: {
+// MULTIPARAM-NEXT: "kind": "text",
+// MULTIPARAM-NEXT: "spelling": ")) "
+// MULTIPARAM-NEXT: },
+// MULTIPARAM-NEXT: {
+// MULTIPARAM-NEXT: "kind": "internalParam",
+// MULTIPARAM-NEXT: "spelling": "block"
+// MULTIPARAM-NEXT: }
+// MULTIPARAM-NEXT: ],
+// MULTIPARAM-NEXT: "name": "block"
+// MULTIPARAM-NEXT: }
+// MULTIPARAM-NEXT: ],
+// MULTIPARAM-NEXT: "returns": [
+// MULTIPARAM-NEXT: {
+// MULTIPARAM-NEXT: "kind": "typeIdentifier",
+// MULTIPARAM-NEXT: "preciseIdentifier": "c:v",
+// MULTIPARAM-NEXT: "spelling": "void"
+// MULTIPARAM-NEXT: }
+// MULTIPARAM-NEXT: ]
+// MULTIPARAM-NEXT: },
+
+// RUN: FileCheck %s --input-file %t/output.symbols.json --check-prefix VARIADIC
-(void)methodBlockVariadic:(int (^)(int foo, ...))block;
+// VARIADIC-LABEL: "!testLabel": "c:objc(cs)Foo(im)methodBlockVariadic:"
+// VARIADIC: "declarationFragments": [
+// VARIADIC-NEXT: {
+// VARIADIC-NEXT: "kind": "text",
+// VARIADIC-NEXT: "spelling": "- ("
+// VARIADIC-NEXT: },
+// VARIADIC-NEXT: {
+// VARIADIC-NEXT: "kind": "typeIdentifier",
+// VARIADIC-NEXT: "preciseIdentifier": "c:v",
+// VARIADIC-NEXT: "spelling": "void"
+// VARIADIC-NEXT: },
+// VARIADIC-NEXT: {
+// VARIADIC-NEXT: "kind": "text",
+// VARIADIC-NEXT: "spelling": ") "
+// VARIADIC-NEXT: },
+// VARIADIC-NEXT: {
+// VARIADIC-NEXT: "kind": "identifier",
+// VARIADIC-NEXT: "spelling": "methodBlockVariadic:"
+// VARIADIC-NEXT: },
+// VARIADIC-NEXT: {
+// VARIADIC-NEXT: "kind": "text",
+// VARIADIC-NEXT: "spelling": "("
+// VARIADIC-NEXT: },
+// VARIADIC-NEXT: {
+// VARIADIC-NEXT: "kind": "typeIdentifier",
+// VARIADIC-NEXT: "preciseIdentifier": "c:I",
+// VARIADIC-NEXT: "spelling": "int"
+// VARIADIC-NEXT: },
+// VARIADIC-NEXT: {
+// VARIADIC-NEXT: "kind": "text",
+// VARIADIC-NEXT: "spelling": " (^"
+// VARIADIC-NEXT: },
+// VARIADIC-NEXT: {
+// VARIADIC-NEXT: "kind": "text",
+// VARIADIC-NEXT: "spelling": ")("
+// VARIADIC-NEXT: },
+// VARIADIC-NEXT: {
+// VARIADIC-NEXT: "kind": "typeIdentifier",
+// VARIADIC-NEXT: "preciseIdentifier": "c:I",
+// VARIADIC-NEXT: "spelling": "int"
+// VARIADIC-NEXT: },
+// VARIADIC-NEXT: {
+// VARIADIC-NEXT: "kind": "text",
+// VARIADIC-NEXT: "spelling": " "
+// VARIADIC-NEXT: },
+// VARIADIC-NEXT: {
+// VARIADIC-NEXT: "kind": "internalParam",
+// VARIADIC-NEXT: "spelling": "foo"
+// VARIADIC-NEXT: },
+// VARIADIC-NEXT: {
+// VARIADIC-NEXT: "kind": "text",
+// VARIADIC-NEXT: "spelling": ", ...)) "
+// VARIADIC-NEXT: },
+// VARIADIC-NEXT: {
+// VARIADIC-NEXT: "kind": "internalParam",
+// VARIADIC-NEXT: "spelling": "block"
+// VARIADIC-NEXT: },
+// VARIADIC-NEXT: {
+// VARIADIC-NEXT: "kind": "text",
+// VARIADIC-NEXT: "spelling": ";"
+// VARIADIC-NEXT: }
+// VARIADIC-NEXT: ],
+// VARIADIC: "functionSignature": {
+// VARIADIC-NEXT: "parameters": [
+// VARIADIC-NEXT: {
+// VARIADIC-NEXT: "declarationFragments": [
+// VARIADIC-NEXT: {
+// VARIADIC-NEXT: "kind": "text",
+// VARIADIC-NEXT: "spelling": "("
+// VARIADIC-NEXT: },
+// VARIADIC-NEXT: {
+// VARIADIC-NEXT: "kind": "typeIdentifier",
+// VARIADIC-NEXT: "preciseIdentifier": "c:I",
+// VARIADIC-NEXT: "spelling": "int"
+// VARIADIC-NEXT: },
+// VARIADIC-NEXT: {
+// VARIADIC-NEXT: "kind": "text",
+// VARIADIC-NEXT: "spelling": " (^"
+// VARIADIC-NEXT: },
+// VARIADIC-NEXT: {
+// VARIADIC-NEXT: "kind": "text",
+// VARIADIC-NEXT: "spelling": ")("
+// VARIADIC-NEXT: },
+// VARIADIC-NEXT: {
+// VARIADIC-NEXT: "kind": "typeIdentifier",
+// VARIADIC-NEXT: "preciseIdentifier": "c:I",
+// VARIADIC-NEXT: "spelling": "int"
+// VARIADIC-NEXT: },
+// VARIADIC-NEXT: {
+// VARIADIC-NEXT: "kind": "text",
+// VARIADIC-NEXT: "spelling": " "
+// VARIADIC-NEXT: },
+// VARIADIC-NEXT: {
+// VARIADIC-NEXT: "kind": "internalParam",
+// VARIADIC-NEXT: "spelling": "foo"
+// VARIADIC-NEXT: },
+// VARIADIC-NEXT: {
+// VARIADIC-NEXT: "kind": "text",
+// VARIADIC-NEXT: "spelling": ", ...)) "
+// VARIADIC-NEXT: },
+// VARIADIC-NEXT: {
+// VARIADIC-NEXT: "kind": "internalParam",
+// VARIADIC-NEXT: "spelling": "block"
+// VARIADIC-NEXT: }
+// VARIADIC-NEXT: ],
+// VARIADIC-NEXT: "name": "block"
+// VARIADIC-NEXT: }
+// VARIADIC-NEXT: ],
+// VARIADIC-NEXT: "returns": [
+// VARIADIC-NEXT: {
+// VARIADIC-NEXT: "kind": "typeIdentifier",
+// VARIADIC-NEXT: "preciseIdentifier": "c:v",
+// VARIADIC-NEXT: "spelling": "void"
+// VARIADIC-NEXT: }
+// VARIADIC-NEXT: ]
+// VARIADIC-NEXT: },
@end
+// RUN: FileCheck %s --input-file %t/output.symbols.json --check-prefix FUNC
void func(int (^arg)(int foo));
+// FUNC-LABEL: "!testLabel": "c:@F@func"
+// FUNC: "declarationFragments": [
+// FUNC-NEXT: {
+// FUNC-NEXT: "kind": "typeIdentifier",
+// FUNC-NEXT: "preciseIdentifier": "c:v",
+// FUNC-NEXT: "spelling": "void"
+// FUNC-NEXT: },
+// FUNC-NEXT: {
+// FUNC-NEXT: "kind": "text",
+// FUNC-NEXT: "spelling": " "
+// FUNC-NEXT: },
+// FUNC-NEXT: {
+// FUNC-NEXT: "kind": "identifier",
+// FUNC-NEXT: "spelling": "func"
+// FUNC-NEXT: },
+// FUNC-NEXT: {
+// FUNC-NEXT: "kind": "text",
+// FUNC-NEXT: "spelling": "("
+// FUNC-NEXT: },
+// FUNC-NEXT: {
+// FUNC-NEXT: "kind": "typeIdentifier",
+// FUNC-NEXT: "preciseIdentifier": "c:I",
+// FUNC-NEXT: "spelling": "int"
+// FUNC-NEXT: },
+// FUNC-NEXT: {
+// FUNC-NEXT: "kind": "text",
+// FUNC-NEXT: "spelling": " (^"
+// FUNC-NEXT: },
+// FUNC-NEXT: {
+// FUNC-NEXT: "kind": "internalParam",
+// FUNC-NEXT: "spelling": "arg"
+// FUNC-NEXT: },
+// FUNC-NEXT: {
+// FUNC-NEXT: "kind": "text",
+// FUNC-NEXT: "spelling": ")("
+// FUNC-NEXT: },
+// FUNC-NEXT: {
+// FUNC-NEXT: "kind": "typeIdentifier",
+// FUNC-NEXT: "preciseIdentifier": "c:I",
+// FUNC-NEXT: "spelling": "int"
+// FUNC-NEXT: },
+// FUNC-NEXT: {
+// FUNC-NEXT: "kind": "text",
+// FUNC-NEXT: "spelling": " "
+// FUNC-NEXT: },
+// FUNC-NEXT: {
+// FUNC-NEXT: "kind": "internalParam",
+// FUNC-NEXT: "spelling": "foo"
+// FUNC-NEXT: },
+// FUNC-NEXT: {
+// FUNC-NEXT: "kind": "text",
+// FUNC-NEXT: "spelling": "));"
+// FUNC-NEXT: }
+// FUNC-NEXT: ],
+// FUNC: "functionSignature": {
+// FUNC-NEXT: "parameters": [
+// FUNC-NEXT: {
+// FUNC-NEXT: "declarationFragments": [
+// FUNC-NEXT: {
+// FUNC-NEXT: "kind": "typeIdentifier",
+// FUNC-NEXT: "preciseIdentifier": "c:I",
+// FUNC-NEXT: "spelling": "int"
+// FUNC-NEXT: },
+// FUNC-NEXT: {
+// FUNC-NEXT: "kind": "text",
+// FUNC-NEXT: "spelling": " (^"
+// FUNC-NEXT: },
+// FUNC-NEXT: {
+// FUNC-NEXT: "kind": "internalParam",
+// FUNC-NEXT: "spelling": "arg"
+// FUNC-NEXT: },
+// FUNC-NEXT: {
+// FUNC-NEXT: "kind": "text",
+// FUNC-NEXT: "spelling": ")("
+// FUNC-NEXT: },
+// FUNC-NEXT: {
+// FUNC-NEXT: "kind": "typeIdentifier",
+// FUNC-NEXT: "preciseIdentifier": "c:I",
+// FUNC-NEXT: "spelling": "int"
+// FUNC-NEXT: },
+// FUNC-NEXT: {
+// FUNC-NEXT: "kind": "text",
+// FUNC-NEXT: "spelling": " "
+// FUNC-NEXT: },
+// FUNC-NEXT: {
+// FUNC-NEXT: "kind": "internalParam",
+// FUNC-NEXT: "spelling": "foo"
+// FUNC-NEXT: },
+// FUNC-NEXT: {
+// FUNC-NEXT: "kind": "text",
+// FUNC-NEXT: "spelling": ")"
+// FUNC-NEXT: }
+// FUNC-NEXT: ],
+// FUNC-NEXT: "name": "arg"
+// FUNC-NEXT: }
+// FUNC-NEXT: ],
+// FUNC-NEXT: "returns": [
+// FUNC-NEXT: {
+// FUNC-NEXT: "kind": "typeIdentifier",
+// FUNC-NEXT: "preciseIdentifier": "c:v",
+// FUNC-NEXT: "spelling": "void"
+// FUNC-NEXT: }
+// FUNC-NEXT: ]
+// FUNC-NEXT: },
+// RUN: FileCheck %s --input-file %t/output.symbols.json --check-prefix GLOBAL
int (^global)(int foo);
+// GLOBAL-LABEL: "!testLabel": "c:@global"
+// GLOBAL: "declarationFragments": [
+// GLOBAL-NEXT: {
+// GLOBAL-NEXT: "kind": "typeIdentifier",
+// GLOBAL-NEXT: "preciseIdentifier": "c:I",
+// GLOBAL-NEXT: "spelling": "int"
+// GLOBAL-NEXT: },
+// GLOBAL-NEXT: {
+// GLOBAL-NEXT: "kind": "text",
+// GLOBAL-NEXT: "spelling": " (^"
+// GLOBAL-NEXT: },
+// GLOBAL-NEXT: {
+// GLOBAL-NEXT: "kind": "identifier",
+// GLOBAL-NEXT: "spelling": "global"
+// GLOBAL-NEXT: },
+// GLOBAL-NEXT: {
+// GLOBAL-NEXT: "kind": "text",
+// GLOBAL-NEXT: "spelling": ")("
+// GLOBAL-NEXT: },
+// GLOBAL-NEXT: {
+// GLOBAL-NEXT: "kind": "typeIdentifier",
+// GLOBAL-NEXT: "preciseIdentifier": "c:I",
+// GLOBAL-NEXT: "spelling": "int"
+// GLOBAL-NEXT: },
+// GLOBAL-NEXT: {
+// GLOBAL-NEXT: "kind": "text",
+// GLOBAL-NEXT: "spelling": " "
+// GLOBAL-NEXT: },
+// GLOBAL-NEXT: {
+// GLOBAL-NEXT: "kind": "internalParam",
+// GLOBAL-NEXT: "spelling": "foo"
+// GLOBAL-NEXT: },
+// GLOBAL-NEXT: {
+// GLOBAL-NEXT: "kind": "text",
+// GLOBAL-NEXT: "spelling": ");"
+// GLOBAL-NEXT: }
+// GLOBAL-NEXT: ],
///expected-no-diagnostics
-
-//--- reference.output.json.in
-{
- "metadata": {
- "formatVersion": {
- "major": 0,
- "minor": 5,
- "patch": 3
- },
- "generator": "?"
- },
- "module": {
- "name": "",
- "platform": {
- "architecture": "arm64",
- "operatingSystem": {
- "minimumVersion": {
- "major": 11,
- "minor": 0,
- "patch": 0
- },
- "name": "macosx"
- },
- "vendor": "apple"
- }
- },
- "relationships": [
- {
- "kind": "memberOf",
- "source": "c:objc(cs)Foo(im)methodBlockNoParam:",
- "target": "c:objc(cs)Foo",
- "targetFallback": "Foo"
- },
- {
- "kind": "memberOf",
- "source": "c:objc(cs)Foo(im)methodBlockWithParam:",
- "target": "c:objc(cs)Foo",
- "targetFallback": "Foo"
- },
- {
- "kind": "memberOf",
- "source": "c:objc(cs)Foo(im)methodBlockWithMultipleParam:",
- "target": "c:objc(cs)Foo",
- "targetFallback": "Foo"
- },
- {
- "kind": "memberOf",
- "source": "c:objc(cs)Foo(im)methodBlockVariadic:",
- "target": "c:objc(cs)Foo",
- "targetFallback": "Foo"
- }
- ],
- "symbols": [
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- },
- {
- "kind": "text",
- "spelling": " (^"
- },
- {
- "kind": "identifier",
- "spelling": "global"
- },
- {
- "kind": "text",
- "spelling": ")("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "internalParam",
- "spelling": "foo"
- },
- {
- "kind": "text",
- "spelling": ");"
- }
- ],
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:@global"
- },
- "kind": {
- "displayName": "Global Variable",
- "identifier": "objective-c.var"
- },
- "location": {
- "position": {
- "character": 6,
- "line": 9
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "global"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "global"
- }
- ],
- "title": "global"
- },
- "pathComponents": [
- "global"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:v",
- "spelling": "void"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "func"
- },
- {
- "kind": "text",
- "spelling": "("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- },
- {
- "kind": "text",
- "spelling": " (^"
- },
- {
- "kind": "internalParam",
- "spelling": "arg"
- },
- {
- "kind": "text",
- "spelling": ")("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "internalParam",
- "spelling": "foo"
- },
- {
- "kind": "text",
- "spelling": "));"
- }
- ],
- "functionSignature": {
- "parameters": [
- {
- "declarationFragments": [
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- },
- {
- "kind": "text",
- "spelling": " (^"
- },
- {
- "kind": "internalParam",
- "spelling": "arg"
- },
- {
- "kind": "text",
- "spelling": ")("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "internalParam",
- "spelling": "foo"
- },
- {
- "kind": "text",
- "spelling": ")"
- }
- ],
- "name": "arg"
- }
- ],
- "returns": [
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:v",
- "spelling": "void"
- }
- ]
- },
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:@F@func"
- },
- "kind": {
- "displayName": "Function",
- "identifier": "objective-c.func"
- },
- "location": {
- "position": {
- "character": 5,
- "line": 7
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "func"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "func"
- }
- ],
- "title": "func"
- },
- "pathComponents": [
- "func"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "@interface"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "Foo"
- }
- ],
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(cs)Foo"
- },
- "kind": {
- "displayName": "Class",
- "identifier": "objective-c.class"
- },
- "location": {
- "position": {
- "character": 11,
- "line": 0
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "Foo"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "Foo"
- }
- ],
- "title": "Foo"
- },
- "pathComponents": [
- "Foo"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "text",
- "spelling": "- ("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:v",
- "spelling": "void"
- },
- {
- "kind": "text",
- "spelling": ") "
- },
- {
- "kind": "identifier",
- "spelling": "methodBlockNoParam:"
- },
- {
- "kind": "text",
- "spelling": "("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:v",
- "spelling": "void"
- },
- {
- "kind": "text",
- "spelling": " (^"
- },
- {
- "kind": "text",
- "spelling": ")()) "
- },
- {
- "kind": "internalParam",
- "spelling": "block"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "functionSignature": {
- "parameters": [
- {
- "declarationFragments": [
- {
- "kind": "text",
- "spelling": "("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:v",
- "spelling": "void"
- },
- {
- "kind": "text",
- "spelling": " (^"
- },
- {
- "kind": "text",
- "spelling": ")()) "
- },
- {
- "kind": "internalParam",
- "spelling": "block"
- }
- ],
- "name": "block"
- }
- ],
- "returns": [
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:v",
- "spelling": "void"
- }
- ]
- },
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(cs)Foo(im)methodBlockNoParam:"
- },
- "kind": {
- "displayName": "Instance Method",
- "identifier": "objective-c.method"
- },
- "location": {
- "position": {
- "character": 0,
- "line": 1
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "methodBlockNoParam:"
- }
- ],
- "subHeading": [
- {
- "kind": "text",
- "spelling": "- "
- },
- {
- "kind": "identifier",
- "spelling": "methodBlockNoParam:"
- }
- ],
- "title": "methodBlockNoParam:"
- },
- "pathComponents": [
- "Foo",
- "methodBlockNoParam:"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "text",
- "spelling": "- ("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:v",
- "spelling": "void"
- },
- {
- "kind": "text",
- "spelling": ") "
- },
- {
- "kind": "identifier",
- "spelling": "methodBlockWithParam:"
- },
- {
- "kind": "text",
- "spelling": "("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- },
- {
- "kind": "text",
- "spelling": " (^"
- },
- {
- "kind": "text",
- "spelling": ")("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "internalParam",
- "spelling": "foo"
- },
- {
- "kind": "text",
- "spelling": ")) "
- },
- {
- "kind": "internalParam",
- "spelling": "block"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "functionSignature": {
- "parameters": [
- {
- "declarationFragments": [
- {
- "kind": "text",
- "spelling": "("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- },
- {
- "kind": "text",
- "spelling": " (^"
- },
- {
- "kind": "text",
- "spelling": ")("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "internalParam",
- "spelling": "foo"
- },
- {
- "kind": "text",
- "spelling": ")) "
- },
- {
- "kind": "internalParam",
- "spelling": "block"
- }
- ],
- "name": "block"
- }
- ],
- "returns": [
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:v",
- "spelling": "void"
- }
- ]
- },
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(cs)Foo(im)methodBlockWithParam:"
- },
- "kind": {
- "displayName": "Instance Method",
- "identifier": "objective-c.method"
- },
- "location": {
- "position": {
- "character": 0,
- "line": 2
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "methodBlockWithParam:"
- }
- ],
- "subHeading": [
- {
- "kind": "text",
- "spelling": "- "
- },
- {
- "kind": "identifier",
- "spelling": "methodBlockWithParam:"
- }
- ],
- "title": "methodBlockWithParam:"
- },
- "pathComponents": [
- "Foo",
- "methodBlockWithParam:"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "text",
- "spelling": "- ("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:v",
- "spelling": "void"
- },
- {
- "kind": "text",
- "spelling": ") "
- },
- {
- "kind": "identifier",
- "spelling": "methodBlockWithMultipleParam:"
- },
- {
- "kind": "text",
- "spelling": "("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- },
- {
- "kind": "text",
- "spelling": " (^"
- },
- {
- "kind": "text",
- "spelling": ")("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "internalParam",
- "spelling": "foo"
- },
- {
- "kind": "text",
- "spelling": ", "
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:i",
- "spelling": "unsigned int"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "internalParam",
- "spelling": "baz"
- },
- {
- "kind": "text",
- "spelling": ")) "
- },
- {
- "kind": "internalParam",
- "spelling": "block"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "functionSignature": {
- "parameters": [
- {
- "declarationFragments": [
- {
- "kind": "text",
- "spelling": "("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- },
- {
- "kind": "text",
- "spelling": " (^"
- },
- {
- "kind": "text",
- "spelling": ")("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "internalParam",
- "spelling": "foo"
- },
- {
- "kind": "text",
- "spelling": ", "
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:i",
- "spelling": "unsigned int"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "internalParam",
- "spelling": "baz"
- },
- {
- "kind": "text",
- "spelling": ")) "
- },
- {
- "kind": "internalParam",
- "spelling": "block"
- }
- ],
- "name": "block"
- }
- ],
- "returns": [
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:v",
- "spelling": "void"
- }
- ]
- },
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(cs)Foo(im)methodBlockWithMultipleParam:"
- },
- "kind": {
- "displayName": "Instance Method",
- "identifier": "objective-c.method"
- },
- "location": {
- "position": {
- "character": 0,
- "line": 3
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "methodBlockWithMultipleParam:"
- }
- ],
- "subHeading": [
- {
- "kind": "text",
- "spelling": "- "
- },
- {
- "kind": "identifier",
- "spelling": "methodBlockWithMultipleParam:"
- }
- ],
- "title": "methodBlockWithMultipleParam:"
- },
- "pathComponents": [
- "Foo",
- "methodBlockWithMultipleParam:"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "text",
- "spelling": "- ("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:v",
- "spelling": "void"
- },
- {
- "kind": "text",
- "spelling": ") "
- },
- {
- "kind": "identifier",
- "spelling": "methodBlockVariadic:"
- },
- {
- "kind": "text",
- "spelling": "("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- },
- {
- "kind": "text",
- "spelling": " (^"
- },
- {
- "kind": "text",
- "spelling": ")("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "internalParam",
- "spelling": "foo"
- },
- {
- "kind": "text",
- "spelling": ", ...)) "
- },
- {
- "kind": "internalParam",
- "spelling": "block"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "functionSignature": {
- "parameters": [
- {
- "declarationFragments": [
- {
- "kind": "text",
- "spelling": "("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- },
- {
- "kind": "text",
- "spelling": " (^"
- },
- {
- "kind": "text",
- "spelling": ")("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "internalParam",
- "spelling": "foo"
- },
- {
- "kind": "text",
- "spelling": ", ...)) "
- },
- {
- "kind": "internalParam",
- "spelling": "block"
- }
- ],
- "name": "block"
- }
- ],
- "returns": [
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:v",
- "spelling": "void"
- }
- ]
- },
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(cs)Foo(im)methodBlockVariadic:"
- },
- "kind": {
- "displayName": "Instance Method",
- "identifier": "objective-c.method"
- },
- "location": {
- "position": {
- "character": 0,
- "line": 4
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "methodBlockVariadic:"
- }
- ],
- "subHeading": [
- {
- "kind": "text",
- "spelling": "- "
- },
- {
- "kind": "identifier",
- "spelling": "methodBlockVariadic:"
- }
- ],
- "title": "methodBlockVariadic:"
- },
- "pathComponents": [
- "Foo",
- "methodBlockVariadic:"
- ]
- }
- ]
-}
diff --git a/clang/test/ExtractAPI/objc_category.m b/clang/test/ExtractAPI/objc_category.m
index 34b0a9e..9177d40 100644
--- a/clang/test/ExtractAPI/objc_category.m
+++ b/clang/test/ExtractAPI/objc_category.m
@@ -1,341 +1,21 @@
// RUN: rm -rf %t
-// RUN: split-file %s %t
-// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
-// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang -extract-api -x objective-c-header -target arm64-apple-macosx \
-// RUN: %t/input.h -o %t/output.json | FileCheck -allow-empty %s
+// RUN: %clang_cc1 -extract-api --pretty-sgf --emit-sgf-symbol-labels-for-testing \
+// RUN: -triple arm64-apple-macosx -x objective-c-header %s -o - -verify | FileCheck %s
-// Generator version is not consistent across test runs, normalize it.
-// RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \
-// RUN: %t/output.json >> %t/output-normalized.json
-// RUN: diff %t/reference.output.json %t/output-normalized.json
-
-// CHECK-NOT: error:
-// CHECK-NOT: warning:
-
-//--- input.h
-@protocol Protocol;
+@protocol Protocol
+@end
@interface Interface
@end
@interface Interface (Category) <Protocol>
+// CHECK-DAG: "!testRelLabel": "conformsTo $ c:objc(cs)Interface $ c:objc(pl)Protocol"
@property int Property;
+// CHECK-DAG: "!testRelLabel": "memberOf $ c:objc(cs)Interface(py)Property $ c:objc(cs)Interface"
- (void)InstanceMethod;
+// CHECK-DAG: "!testRelLabel": "memberOf $ c:objc(cs)Interface(im)InstanceMethod $ c:objc(cs)Interface"
+ (void)ClassMethod;
+// CHECK-DAG: "!testRelLabel": "memberOf $ c:objc(cs)Interface(cm)ClassMethod $ c:objc(cs)Interface"
@end
-//--- reference.output.json.in
-{
- "metadata": {
- "formatVersion": {
- "major": 0,
- "minor": 5,
- "patch": 3
- },
- "generator": "?"
- },
- "module": {
- "name": "",
- "platform": {
- "architecture": "arm64",
- "operatingSystem": {
- "minimumVersion": {
- "major": 11,
- "minor": 0,
- "patch": 0
- },
- "name": "macosx"
- },
- "vendor": "apple"
- }
- },
- "relationships": [
- {
- "kind": "memberOf",
- "source": "c:objc(cs)Interface(im)InstanceMethod",
- "target": "c:objc(cs)Interface",
- "targetFallback": "Interface"
- },
- {
- "kind": "memberOf",
- "source": "c:objc(cs)Interface(cm)ClassMethod",
- "target": "c:objc(cs)Interface",
- "targetFallback": "Interface"
- },
- {
- "kind": "memberOf",
- "source": "c:objc(cs)Interface(py)Property",
- "target": "c:objc(cs)Interface",
- "targetFallback": "Interface"
- },
- {
- "kind": "conformsTo",
- "source": "c:objc(cs)Interface",
- "target": "c:objc(pl)Protocol",
- "targetFallback": "Protocol"
- }
- ],
- "symbols": [
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "@interface"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "Interface"
- }
- ],
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(cs)Interface"
- },
- "kind": {
- "displayName": "Class",
- "identifier": "objective-c.class"
- },
- "location": {
- "position": {
- "character": 11,
- "line": 2
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "Interface"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "Interface"
- }
- ],
- "title": "Interface"
- },
- "pathComponents": [
- "Interface"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "text",
- "spelling": "- ("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:v",
- "spelling": "void"
- },
- {
- "kind": "text",
- "spelling": ") "
- },
- {
- "kind": "identifier",
- "spelling": "InstanceMethod"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "functionSignature": {
- "returns": [
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:v",
- "spelling": "void"
- }
- ]
- },
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(cs)Interface(im)InstanceMethod"
- },
- "kind": {
- "displayName": "Instance Method",
- "identifier": "objective-c.method"
- },
- "location": {
- "position": {
- "character": 0,
- "line": 7
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "InstanceMethod"
- }
- ],
- "subHeading": [
- {
- "kind": "text",
- "spelling": "- "
- },
- {
- "kind": "identifier",
- "spelling": "InstanceMethod"
- }
- ],
- "title": "InstanceMethod"
- },
- "pathComponents": [
- "Interface",
- "InstanceMethod"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "text",
- "spelling": "+ ("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:v",
- "spelling": "void"
- },
- {
- "kind": "text",
- "spelling": ") "
- },
- {
- "kind": "identifier",
- "spelling": "ClassMethod"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "functionSignature": {
- "returns": [
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:v",
- "spelling": "void"
- }
- ]
- },
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(cs)Interface(cm)ClassMethod"
- },
- "kind": {
- "displayName": "Type Method",
- "identifier": "objective-c.type.method"
- },
- "location": {
- "position": {
- "character": 0,
- "line": 8
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "ClassMethod"
- }
- ],
- "subHeading": [
- {
- "kind": "text",
- "spelling": "+ "
- },
- {
- "kind": "identifier",
- "spelling": "ClassMethod"
- }
- ],
- "title": "ClassMethod"
- },
- "pathComponents": [
- "Interface",
- "ClassMethod"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "@property"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "Property"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(cs)Interface(py)Property"
- },
- "kind": {
- "displayName": "Instance Property",
- "identifier": "objective-c.property"
- },
- "location": {
- "position": {
- "character": 14,
- "line": 6
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "Property"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "Property"
- }
- ],
- "title": "Property"
- },
- "pathComponents": [
- "Interface",
- "Property"
- ]
- }
- ]
-}
+// expected-no-diagnostics
diff --git a/clang/test/ExtractAPI/objc_external_category.m b/clang/test/ExtractAPI/objc_external_category.m
new file mode 100644
index 0000000..47e699c
--- /dev/null
+++ b/clang/test/ExtractAPI/objc_external_category.m
@@ -0,0 +1,49 @@
+// RUN: rm -rf %t
+// RUN: split-file %s %t
+// RUN: %clang_cc1 -extract-api --pretty-sgf --emit-sgf-symbol-labels-for-testing \
+// RUN: --emit-extension-symbol-graphs --symbol-graph-dir=%t/symbols \
+// RUN: --product-name=Module -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/modules-cache \
+// RUN: -triple arm64-apple-macosx -x objective-c-header %t/input.h -verify
+
+//--- input.h
+#include "ExternalModule.h"
+
+@interface ExtInterface (Category)
+@property int Property;
+- (void)InstanceMethod;
++ (void)ClassMethod;
+@end
+
+@interface ModInterface
+@end
+
+// expected-no-diagnostics
+
+//--- ExternalModule.h
+@interface ExtInterface
+@end
+
+//--- module.modulemap
+module ExternalModule {
+ header "ExternalModule.h"
+}
+
+// RUN: FileCheck %s --input-file %t/symbols/Module.symbols.json --check-prefix MOD
+// MOD-NOT: "!testRelLabel": "memberOf $ c:objc(cs)ExtInterface(py)Property $ c:objc(cs)ExtInterface"
+// MOD-NOT: "!testRelLabel": "memberOf $ c:objc(cs)ExtInterface(im)InstanceMethod $ c:objc(cs)ExtInterface"
+// MOD-NOT: "!testRelLabel": "memberOf $ c:objc(cs)ExtInterface(cm)ClassMethod $ c:objc(cs)ExtInterface"
+// MOD-NOT: "!testLabel": "c:objc(cs)ExtInterface(py)Property"
+// MOD-NOT: "!testLabel": "c:objc(cs)ExtInterface(im)InstanceMethod"
+// MOD-NOT: "!testLabel": "c:objc(cs)ExtInterface(cm)ClassMethod"
+// MOD-NOT: "!testLabel": "c:objc(cs)ExtInterface"
+// MOD-DAG: "!testLabel": "c:objc(cs)ModInterface"
+
+// RUN: FileCheck %s --input-file %t/symbols/ExternalModule@Module.symbols.json --check-prefix EXT
+// EXT-DAG: "!testRelLabel": "memberOf $ c:objc(cs)ExtInterface(py)Property $ c:objc(cs)ExtInterface"
+// EXT-DAG: "!testRelLabel": "memberOf $ c:objc(cs)ExtInterface(im)InstanceMethod $ c:objc(cs)ExtInterface"
+// EXT-DAG: "!testRelLabel": "memberOf $ c:objc(cs)ExtInterface(cm)ClassMethod $ c:objc(cs)ExtInterface"
+// EXT-DAG: "!testLabel": "c:objc(cs)ExtInterface(py)Property"
+// EXT-DAG: "!testLabel": "c:objc(cs)ExtInterface(im)InstanceMethod"
+// EXT-DAG: "!testLabel": "c:objc(cs)ExtInterface(cm)ClassMethod"
+// EXT-NOT: "!testLabel": "c:objc(cs)ExtInterface"
+// EXT-NOT: "!testLabel": "c:objc(cs)ModInterface"
diff --git a/clang/test/ExtractAPI/objc_id_protocol.m b/clang/test/ExtractAPI/objc_id_protocol.m
index 0b0f1b3..f2a03a9 100644
--- a/clang/test/ExtractAPI/objc_id_protocol.m
+++ b/clang/test/ExtractAPI/objc_id_protocol.m
@@ -1,317 +1,56 @@
// RUN: rm -rf %t
-// RUN: split-file %s %t
-// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
-// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang -extract-api -x objective-c-header -target arm64-apple-macosx \
-// RUN: %t/input.h -o %t/output.json | FileCheck -allow-empty %s
+// RUN: %clang_cc1 -extract-api --pretty-sgf --emit-sgf-symbol-labels-for-testing \
+// RUN: -x objective-c-header -triple arm64-apple-macosx %s -o - -verify | FileCheck %s
-// Generator version is not consistent across test runs, normalize it.
-// RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \
-// RUN: %t/output.json >> %t/output-normalized.json
-// RUN: diff %t/reference.output.json %t/output-normalized.json
-
-// CHECK-NOT: error:
-// CHECK-NOT: warning:
-
-//--- input.h
@protocol MyProtocol
@end
@interface MyInterface
@property(copy, readwrite) id<MyProtocol> obj1;
-@property(readwrite) id<MyProtocol> *obj2;
+// CHECK-LABEL: "!testLabel": "c:objc(cs)MyInterface(py)obj1"
+// CHECK: "declarationFragments": [
+// CHECK-NEXT: {
+// CHECK-NEXT: "kind": "keyword",
+// CHECK-NEXT: "spelling": "@property"
+// CHECK-NEXT: },
+// CHECK-NEXT: {
+// CHECK-NEXT: "kind": "text",
+// CHECK-NEXT: "spelling": " ("
+// CHECK-NEXT: },
+// CHECK-NEXT: {
+// CHECK-NEXT: "kind": "keyword",
+// CHECK-NEXT: "spelling": "copy"
+// CHECK-NEXT: },
+// CHECK-NEXT: {
+// CHECK-NEXT: "kind": "text",
+// CHECK-NEXT: "spelling": ", "
+// CHECK-NEXT: },
+// CHECK-NEXT: {
+// CHECK-NEXT: "kind": "keyword",
+// CHECK-NEXT: "spelling": "readwrite"
+// CHECK-NEXT: },
+// CHECK-NEXT: {
+// CHECK-NEXT: "kind": "text",
+// CHECK-NEXT: "spelling": ") "
+// CHECK-NEXT: },
+// CHECK-NEXT: {
+// CHECK-NEXT: "kind": "typeIdentifier",
+// CHECK-NEXT: "preciseIdentifier": "c:Qoobjc(pl)MyProtocol",
+// CHECK-NEXT: "spelling": "id<MyProtocol>"
+// CHECK-NEXT: },
+// CHECK-NEXT: {
+// CHECK-NEXT: "kind": "text",
+// CHECK-NEXT: "spelling": " "
+// CHECK-NEXT: },
+// CHECK-NEXT: {
+// CHECK-NEXT: "kind": "identifier",
+// CHECK-NEXT: "spelling": "obj1"
+// CHECK-NEXT: },
+// CHECK-NEXT: {
+// CHECK-NEXT: "kind": "text",
+// CHECK-NEXT: "spelling": ";"
+// CHECK-NEXT: }
+// CHECK-NEXT: ],
@end
-//--- reference.output.json.in
-{
- "metadata": {
- "formatVersion": {
- "major": 0,
- "minor": 5,
- "patch": 3
- },
- "generator": "?"
- },
- "module": {
- "name": "",
- "platform": {
- "architecture": "arm64",
- "operatingSystem": {
- "minimumVersion": {
- "major": 11,
- "minor": 0,
- "patch": 0
- },
- "name": "macosx"
- },
- "vendor": "apple"
- }
- },
- "relationships": [
- {
- "kind": "memberOf",
- "source": "c:objc(cs)MyInterface(py)obj1",
- "target": "c:objc(cs)MyInterface",
- "targetFallback": "MyInterface"
- },
- {
- "kind": "memberOf",
- "source": "c:objc(cs)MyInterface(py)obj2",
- "target": "c:objc(cs)MyInterface",
- "targetFallback": "MyInterface"
- }
- ],
- "symbols": [
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "@interface"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "MyInterface"
- }
- ],
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(cs)MyInterface"
- },
- "kind": {
- "displayName": "Class",
- "identifier": "objective-c.class"
- },
- "location": {
- "position": {
- "character": 11,
- "line": 3
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "MyInterface"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "MyInterface"
- }
- ],
- "title": "MyInterface"
- },
- "pathComponents": [
- "MyInterface"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "@property"
- },
- {
- "kind": "text",
- "spelling": " ("
- },
- {
- "kind": "keyword",
- "spelling": "copy"
- },
- {
- "kind": "text",
- "spelling": ", "
- },
- {
- "kind": "keyword",
- "spelling": "readwrite"
- },
- {
- "kind": "text",
- "spelling": ") "
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:Qoobjc(pl)MyProtocol",
- "spelling": "id<MyProtocol>"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "obj1"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(cs)MyInterface(py)obj1"
- },
- "kind": {
- "displayName": "Instance Property",
- "identifier": "objective-c.property"
- },
- "location": {
- "position": {
- "character": 42,
- "line": 4
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "obj1"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "obj1"
- }
- ],
- "title": "obj1"
- },
- "pathComponents": [
- "MyInterface",
- "obj1"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "@property"
- },
- {
- "kind": "text",
- "spelling": " ("
- },
- {
- "kind": "keyword",
- "spelling": "readwrite"
- },
- {
- "kind": "text",
- "spelling": ") "
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:Qoobjc(pl)MyProtocol",
- "spelling": "id<MyProtocol>"
- },
- {
- "kind": "text",
- "spelling": " * "
- },
- {
- "kind": "identifier",
- "spelling": "obj2"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(cs)MyInterface(py)obj2"
- },
- "kind": {
- "displayName": "Instance Property",
- "identifier": "objective-c.property"
- },
- "location": {
- "position": {
- "character": 37,
- "line": 5
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "obj2"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "obj2"
- }
- ],
- "title": "obj2"
- },
- "pathComponents": [
- "MyInterface",
- "obj2"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "@protocol"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "MyProtocol"
- }
- ],
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(pl)MyProtocol"
- },
- "kind": {
- "displayName": "Protocol",
- "identifier": "objective-c.protocol"
- },
- "location": {
- "position": {
- "character": 10,
- "line": 0
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "MyProtocol"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "MyProtocol"
- }
- ],
- "title": "MyProtocol"
- },
- "pathComponents": [
- "MyProtocol"
- ]
- }
- ]
-}
+
+// expected-no-diagnostics
diff --git a/clang/test/ExtractAPI/objc_instancetype.m b/clang/test/ExtractAPI/objc_instancetype.m
index d9d259f..071ebe4 100644
--- a/clang/test/ExtractAPI/objc_instancetype.m
+++ b/clang/test/ExtractAPI/objc_instancetype.m
@@ -1,8 +1,8 @@
// RUN: rm -rf %t
// RUN: split-file %s %t
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
- // RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang_cc1 -extract-api -triple arm64-apple-macosx -x objective-c-header %t/input.h -o %t/output.json -verify
+// RUN: %t/reference.output.json.in >> %t/reference.output.json
+// RUN: %clang_cc1 -extract-api --pretty-sgf -triple arm64-apple-macosx -x objective-c-header %t/input.h -o %t/output.json -verify
// Generator version is not consistent across test runs, normalize it.
// RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \
diff --git a/clang/test/ExtractAPI/objc_interface.m b/clang/test/ExtractAPI/objc_interface.m
index ab1772a..4abccdd 100644
--- a/clang/test/ExtractAPI/objc_interface.m
+++ b/clang/test/ExtractAPI/objc_interface.m
@@ -1,701 +1,360 @@
// RUN: rm -rf %t
-// RUN: split-file %s %t
-// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
-// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang -extract-api -x objective-c-header -target arm64-apple-macosx \
-// RUN: %t/input.h -o %t/output.json | FileCheck -allow-empty %s
+// RUN: %clang_cc1 -extract-api --pretty-sgf --emit-sgf-symbol-labels-for-testing \
+// RUN: -x objective-c-header -triple arm64-apple-macosx %s -o %t/output.symbols.json -verify
-// Generator version is not consistent across test runs, normalize it.
-// RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \
-// RUN: %t/output.json >> %t/output-normalized.json
-// RUN: diff %t/reference.output.json %t/output-normalized.json
-
-// CHECK-NOT: error:
-// CHECK-NOT: warning:
-
-//--- input.h
-@protocol Protocol;
+@protocol Protocol
+@end
+// RUN: FileCheck %s --input-file %t/output.symbols.json --check-prefix SUPER
@interface Super <Protocol>
+// SUPER: "!testRelLabel": "conformsTo $ c:objc(cs)Super $ c:objc(pl)Protocol"
+// SUPER-LABEL: "!testLabel": "c:objc(cs)Super"
+// SUPER: "accessLevel": "public",
+// SUPER: "declarationFragments": [
+// SUPER-NEXT: {
+// SUPER-NEXT: "kind": "keyword",
+// SUPER-NEXT: "spelling": "@interface"
+// SUPER-NEXT: },
+// SUPER-NEXT: {
+// SUPER-NEXT: "kind": "text",
+// SUPER-NEXT: "spelling": " "
+// SUPER-NEXT: },
+// SUPER-NEXT: {
+// SUPER-NEXT: "kind": "identifier",
+// SUPER-NEXT: "spelling": "Super"
+// SUPER-NEXT: }
+// SUPER-NEXT: ],
+// SUPER: "kind": {
+// SUPER-NEXT: "displayName": "Class",
+// SUPER-NEXT: "identifier": "objective-c.class"
+// SUPER-NEXT: },
+// SUPER: "title": "Super"
+// SUPER: "pathComponents": [
+// SUPER-NEXT: "Super"
+// SUPER-NEXT: ]
+
+// RUN: FileCheck %s --input-file %t/output.symbols.json --check-prefix PROP
@property(readonly, getter=getProperty) unsigned Property;
+// PROP: "!testRelLabel": "memberOf $ c:objc(cs)Super(py)Property $ c:objc(cs)Super"
+// PROP: "!testLabel": "c:objc(cs)Super(py)Property"
+// PROP: "accessLevel": "public",
+// PROP: "declarationFragments": [
+// PROP-NEXT: {
+// PROP-NEXT: "kind": "keyword",
+// PROP-NEXT: "spelling": "@property"
+// PROP-NEXT: },
+// PROP-NEXT: {
+// PROP-NEXT: "kind": "text",
+// PROP-NEXT: "spelling": " ("
+// PROP-NEXT: },
+// PROP-NEXT: {
+// PROP-NEXT: "kind": "keyword",
+// PROP-NEXT: "spelling": "readonly"
+// PROP-NEXT: },
+// PROP-NEXT: {
+// PROP-NEXT: "kind": "text",
+// PROP-NEXT: "spelling": ", "
+// PROP-NEXT: },
+// PROP-NEXT: {
+// PROP-NEXT: "kind": "keyword",
+// PROP-NEXT: "spelling": "getter"
+// PROP-NEXT: },
+// PROP-NEXT: {
+// PROP-NEXT: "kind": "text",
+// PROP-NEXT: "spelling": "="
+// PROP-NEXT: },
+// PROP-NEXT: {
+// PROP-NEXT: "kind": "identifier",
+// PROP-NEXT: "spelling": "getProperty"
+// PROP-NEXT: },
+// PROP-NEXT: {
+// PROP-NEXT: "kind": "text",
+// PROP-NEXT: "spelling": ") "
+// PROP-NEXT: },
+// PROP-NEXT: {
+// PROP-NEXT: "kind": "typeIdentifier",
+// PROP-NEXT: "preciseIdentifier": "c:i",
+// PROP-NEXT: "spelling": "unsigned int"
+// PROP-NEXT: },
+// PROP-NEXT: {
+// PROP-NEXT: "kind": "text",
+// PROP-NEXT: "spelling": " "
+// PROP-NEXT: },
+// PROP-NEXT: {
+// PROP-NEXT: "kind": "identifier",
+// PROP-NEXT: "spelling": "Property"
+// PROP-NEXT: },
+// PROP-NEXT: {
+// PROP-NEXT: "kind": "text",
+// PROP-NEXT: "spelling": ";"
+// PROP-NEXT: }
+// PROP-NEXT: ],
+// PROP: "kind": {
+// PROP-NEXT: "displayName": "Instance Property",
+// PROP-NEXT: "identifier": "objective-c.property"
+// PROP-NEXT: },
+// PROP: "title": "Property"
+// PROP: "pathComponents": [
+// PROP-NEXT: "Super",
+// PROP-NEXT: "Property"
+// PROP-NEXT: ]
+
+// RUN: FileCheck %s --input-file %t/output.symbols.json --check-prefix GET
+ (id)getWithProperty:(unsigned) Property;
+// GET: "!testRelLabel": "memberOf $ c:objc(cs)Super(cm)getWithProperty: $ c:objc(cs)Super"
+// GET-LABEL: "!testLabel": "c:objc(cs)Super(cm)getWithProperty:"
+// GET: "accessLevel": "public",
+// GET: "declarationFragments": [
+// GET-NEXT: {
+// GET-NEXT: "kind": "text",
+// GET-NEXT: "spelling": "+ ("
+// GET-NEXT: },
+// GET-NEXT: {
+// GET-NEXT: "kind": "keyword",
+// GET-NEXT: "spelling": "id"
+// GET-NEXT: },
+// GET-NEXT: {
+// GET-NEXT: "kind": "text",
+// GET-NEXT: "spelling": ") "
+// GET-NEXT: },
+// GET-NEXT: {
+// GET-NEXT: "kind": "identifier",
+// GET-NEXT: "spelling": "getWithProperty:"
+// GET-NEXT: },
+// GET-NEXT: {
+// GET-NEXT: "kind": "text",
+// GET-NEXT: "spelling": "("
+// GET-NEXT: },
+// GET-NEXT: {
+// GET-NEXT: "kind": "typeIdentifier",
+// GET-NEXT: "preciseIdentifier": "c:i",
+// GET-NEXT: "spelling": "unsigned int"
+// GET-NEXT: },
+// GET-NEXT: {
+// GET-NEXT: "kind": "text",
+// GET-NEXT: "spelling": ") "
+// GET-NEXT: },
+// GET-NEXT: {
+// GET-NEXT: "kind": "internalParam",
+// GET-NEXT: "spelling": "Property"
+// GET-NEXT: },
+// GET-NEXT: {
+// GET-NEXT: "kind": "text",
+// GET-NEXT: "spelling": ";"
+// GET-NEXT: }
+// GET-NEXT: ],
+// GET: "functionSignature": {
+// GET-NEXT: "parameters": [
+// GET-NEXT: {
+// GET-NEXT: "declarationFragments": [
+// GET-NEXT: {
+// GET-NEXT: "kind": "text",
+// GET-NEXT: "spelling": "("
+// GET-NEXT: },
+// GET-NEXT: {
+// GET-NEXT: "kind": "typeIdentifier",
+// GET-NEXT: "preciseIdentifier": "c:i",
+// GET-NEXT: "spelling": "unsigned int"
+// GET-NEXT: },
+// GET-NEXT: {
+// GET-NEXT: "kind": "text",
+// GET-NEXT: "spelling": ") "
+// GET-NEXT: },
+// GET-NEXT: {
+// GET-NEXT: "kind": "internalParam",
+// GET-NEXT: "spelling": "Property"
+// GET-NEXT: }
+// GET-NEXT: ],
+// GET-NEXT: "name": "Property"
+// GET-NEXT: }
+// GET-NEXT: ],
+// GET-NEXT: "returns": [
+// GET-NEXT: {
+// GET-NEXT: "kind": "keyword",
+// GET-NEXT: "spelling": "id"
+// GET-NEXT: }
+// GET-NEXT: ]
+// GET-NEXT: },
+// GET: "kind": {
+// GET-NEXT: "displayName": "Type Method",
+// GET-NEXT: "identifier": "objective-c.type.method"
+// GET-NEXT: },
+// GET: "title": "getWithProperty:"
+// GET: "pathComponents": [
+// GET-NEXT: "Super",
+// GET-NEXT: "getWithProperty:"
+// GET-NEXT: ]
+
+// RUN: FileCheck %s --input-file %t/output.symbols.json --check-prefix SET
- (void)setProperty:(unsigned) Property andOtherThing: (unsigned) Thing;
+// SET: "!testRelLabel": "memberOf $ c:objc(cs)Super(im)setProperty:andOtherThing: $ c:objc(cs)Super"
+// SET-LABEL: "!testLabel": "c:objc(cs)Super(im)setProperty:andOtherThing:"
+// SET: "accessLevel": "public",
+// SET: "declarationFragments": [
+// SET-NEXT: {
+// SET-NEXT: "kind": "text",
+// SET-NEXT: "spelling": "- ("
+// SET-NEXT: },
+// SET-NEXT: {
+// SET-NEXT: "kind": "typeIdentifier",
+// SET-NEXT: "preciseIdentifier": "c:v",
+// SET-NEXT: "spelling": "void"
+// SET-NEXT: },
+// SET-NEXT: {
+// SET-NEXT: "kind": "text",
+// SET-NEXT: "spelling": ") "
+// SET-NEXT: },
+// SET-NEXT: {
+// SET-NEXT: "kind": "identifier",
+// SET-NEXT: "spelling": "setProperty:"
+// SET-NEXT: },
+// SET-NEXT: {
+// SET-NEXT: "kind": "text",
+// SET-NEXT: "spelling": "("
+// SET-NEXT: },
+// SET-NEXT: {
+// SET-NEXT: "kind": "typeIdentifier",
+// SET-NEXT: "preciseIdentifier": "c:i",
+// SET-NEXT: "spelling": "unsigned int"
+// SET-NEXT: },
+// SET-NEXT: {
+// SET-NEXT: "kind": "text",
+// SET-NEXT: "spelling": ") "
+// SET-NEXT: },
+// SET-NEXT: {
+// SET-NEXT: "kind": "internalParam",
+// SET-NEXT: "spelling": "Property"
+// SET-NEXT: },
+// SET-NEXT: {
+// SET-NEXT: "kind": "text",
+// SET-NEXT: "spelling": " "
+// SET-NEXT: },
+// SET-NEXT: {
+// SET-NEXT: "kind": "identifier",
+// SET-NEXT: "spelling": "andOtherThing:"
+// SET-NEXT: },
+// SET-NEXT: {
+// SET-NEXT: "kind": "text",
+// SET-NEXT: "spelling": "("
+// SET-NEXT: },
+// SET-NEXT: {
+// SET-NEXT: "kind": "typeIdentifier",
+// SET-NEXT: "preciseIdentifier": "c:i",
+// SET-NEXT: "spelling": "unsigned int"
+// SET-NEXT: },
+// SET-NEXT: {
+// SET-NEXT: "kind": "text",
+// SET-NEXT: "spelling": ") "
+// SET-NEXT: },
+// SET-NEXT: {
+// SET-NEXT: "kind": "internalParam",
+// SET-NEXT: "spelling": "Thing"
+// SET-NEXT: },
+// SET-NEXT: {
+// SET-NEXT: "kind": "text",
+// SET-NEXT: "spelling": ";"
+// SET-NEXT: }
+// SET-NEXT: ],
+// SET: "functionSignature": {
+// SET-NEXT: "parameters": [
+// SET-NEXT: {
+// SET-NEXT: "declarationFragments": [
+// SET-NEXT: {
+// SET-NEXT: "kind": "text",
+// SET-NEXT: "spelling": "("
+// SET-NEXT: },
+// SET-NEXT: {
+// SET-NEXT: "kind": "typeIdentifier",
+// SET-NEXT: "preciseIdentifier": "c:i",
+// SET-NEXT: "spelling": "unsigned int"
+// SET-NEXT: },
+// SET-NEXT: {
+// SET-NEXT: "kind": "text",
+// SET-NEXT: "spelling": ") "
+// SET-NEXT: },
+// SET-NEXT: {
+// SET-NEXT: "kind": "internalParam",
+// SET-NEXT: "spelling": "Property"
+// SET-NEXT: }
+// SET-NEXT: ],
+// SET-NEXT: "name": "Property"
+// SET-NEXT: },
+// SET-NEXT: {
+// SET-NEXT: "declarationFragments": [
+// SET-NEXT: {
+// SET-NEXT: "kind": "text",
+// SET-NEXT: "spelling": "("
+// SET-NEXT: },
+// SET-NEXT: {
+// SET-NEXT: "kind": "typeIdentifier",
+// SET-NEXT: "preciseIdentifier": "c:i",
+// SET-NEXT: "spelling": "unsigned int"
+// SET-NEXT: },
+// SET-NEXT: {
+// SET-NEXT: "kind": "text",
+// SET-NEXT: "spelling": ") "
+// SET-NEXT: },
+// SET-NEXT: {
+// SET-NEXT: "kind": "internalParam",
+// SET-NEXT: "spelling": "Thing"
+// SET-NEXT: }
+// SET-NEXT: ],
+// SET-NEXT: "name": "Thing"
+// SET-NEXT: }
+// SET-NEXT: ],
+// SET-NEXT: "returns": [
+// SET-NEXT: {
+// SET-NEXT: "kind": "typeIdentifier",
+// SET-NEXT: "preciseIdentifier": "c:v",
+// SET-NEXT: "spelling": "void"
+// SET-NEXT: }
+// SET-NEXT: ]
+// SET-NEXT: },
+// SET: "kind": {
+// SET-NEXT: "displayName": "Instance Method",
+// SET-NEXT: "identifier": "objective-c.method"
+// SET-NEXT: },
+// SET: "title": "setProperty:andOtherThing:"
@end
+// RUN: FileCheck %s --input-file %t/output.symbols.json --check-prefix DERIVED
@interface Derived : Super {
+// DERIVED: "!testRelLabel": "inheritsFrom $ c:objc(cs)Derived $ c:objc(cs)Super"
+
+// RUN: FileCheck %s --input-file %t/output.symbols.json --check-prefix IVAR
char Ivar;
+// IVAR: "!testRelLabel": "memberOf $ c:objc(cs)Derived@Ivar $ c:objc(cs)Derived"
+// IVAR-LABEL: "!testLabel": "c:objc(cs)Derived@Ivar"
+// IVAR: "accessLevel": "public",
+// IVAR: "declarationFragments": [
+// IVAR-NEXT: {
+// IVAR-NEXT: "kind": "typeIdentifier",
+// IVAR-NEXT: "preciseIdentifier": "c:C",
+// IVAR-NEXT: "spelling": "char"
+// IVAR-NEXT: },
+// IVAR-NEXT: {
+// IVAR-NEXT: "kind": "text",
+// IVAR-NEXT: "spelling": " "
+// IVAR-NEXT: },
+// IVAR-NEXT: {
+// IVAR-NEXT: "kind": "identifier",
+// IVAR-NEXT: "spelling": "Ivar"
+// IVAR-NEXT: },
+// IVAR-NEXT: {
+// IVAR-NEXT: "kind": "text",
+// IVAR-NEXT: "spelling": ";"
+// IVAR-NEXT: }
+// IVAR-NEXT: ],
+// IVAR: "kind": {
+// IVAR-NEXT: "displayName": "Instance Variable",
+// IVAR-NEXT: "identifier": "objective-c.ivar"
+// IVAR-NEXT: },
+// IVAR: "title": "Ivar"
+// IVAR: "pathComponents": [
+// IVAR-NEXT: "Derived",
+// IVAR-NEXT: "Ivar"
+// IVAR-NEXT: ]
}
-- (char)getIvar;
@end
-//--- reference.output.json.in
-{
- "metadata": {
- "formatVersion": {
- "major": 0,
- "minor": 5,
- "patch": 3
- },
- "generator": "?"
- },
- "module": {
- "name": "",
- "platform": {
- "architecture": "arm64",
- "operatingSystem": {
- "minimumVersion": {
- "major": 11,
- "minor": 0,
- "patch": 0
- },
- "name": "macosx"
- },
- "vendor": "apple"
- }
- },
- "relationships": [
- {
- "kind": "memberOf",
- "source": "c:objc(cs)Super(cm)getWithProperty:",
- "target": "c:objc(cs)Super",
- "targetFallback": "Super"
- },
- {
- "kind": "memberOf",
- "source": "c:objc(cs)Super(im)setProperty:andOtherThing:",
- "target": "c:objc(cs)Super",
- "targetFallback": "Super"
- },
- {
- "kind": "memberOf",
- "source": "c:objc(cs)Super(py)Property",
- "target": "c:objc(cs)Super",
- "targetFallback": "Super"
- },
- {
- "kind": "conformsTo",
- "source": "c:objc(cs)Super",
- "target": "c:objc(pl)Protocol",
- "targetFallback": "Protocol"
- },
- {
- "kind": "memberOf",
- "source": "c:objc(cs)Derived@Ivar",
- "target": "c:objc(cs)Derived",
- "targetFallback": "Derived"
- },
- {
- "kind": "memberOf",
- "source": "c:objc(cs)Derived(im)getIvar",
- "target": "c:objc(cs)Derived",
- "targetFallback": "Derived"
- },
- {
- "kind": "inheritsFrom",
- "source": "c:objc(cs)Derived",
- "target": "c:objc(cs)Super",
- "targetFallback": "Super"
- }
- ],
- "symbols": [
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "@interface"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "Super"
- }
- ],
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(cs)Super"
- },
- "kind": {
- "displayName": "Class",
- "identifier": "objective-c.class"
- },
- "location": {
- "position": {
- "character": 11,
- "line": 2
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "Super"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "Super"
- }
- ],
- "title": "Super"
- },
- "pathComponents": [
- "Super"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "text",
- "spelling": "+ ("
- },
- {
- "kind": "keyword",
- "spelling": "id"
- },
- {
- "kind": "text",
- "spelling": ") "
- },
- {
- "kind": "identifier",
- "spelling": "getWithProperty:"
- },
- {
- "kind": "text",
- "spelling": "("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:i",
- "spelling": "unsigned int"
- },
- {
- "kind": "text",
- "spelling": ") "
- },
- {
- "kind": "internalParam",
- "spelling": "Property"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "functionSignature": {
- "parameters": [
- {
- "declarationFragments": [
- {
- "kind": "text",
- "spelling": "("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:i",
- "spelling": "unsigned int"
- },
- {
- "kind": "text",
- "spelling": ") "
- },
- {
- "kind": "internalParam",
- "spelling": "Property"
- }
- ],
- "name": "Property"
- }
- ],
- "returns": [
- {
- "kind": "keyword",
- "spelling": "id"
- }
- ]
- },
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(cs)Super(cm)getWithProperty:"
- },
- "kind": {
- "displayName": "Type Method",
- "identifier": "objective-c.type.method"
- },
- "location": {
- "position": {
- "character": 0,
- "line": 4
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "getWithProperty:"
- }
- ],
- "subHeading": [
- {
- "kind": "text",
- "spelling": "+ "
- },
- {
- "kind": "identifier",
- "spelling": "getWithProperty:"
- }
- ],
- "title": "getWithProperty:"
- },
- "pathComponents": [
- "Super",
- "getWithProperty:"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "text",
- "spelling": "- ("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:v",
- "spelling": "void"
- },
- {
- "kind": "text",
- "spelling": ") "
- },
- {
- "kind": "identifier",
- "spelling": "setProperty:"
- },
- {
- "kind": "text",
- "spelling": "("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:i",
- "spelling": "unsigned int"
- },
- {
- "kind": "text",
- "spelling": ") "
- },
- {
- "kind": "internalParam",
- "spelling": "Property"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "andOtherThing:"
- },
- {
- "kind": "text",
- "spelling": "("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:i",
- "spelling": "unsigned int"
- },
- {
- "kind": "text",
- "spelling": ") "
- },
- {
- "kind": "internalParam",
- "spelling": "Thing"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "functionSignature": {
- "parameters": [
- {
- "declarationFragments": [
- {
- "kind": "text",
- "spelling": "("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:i",
- "spelling": "unsigned int"
- },
- {
- "kind": "text",
- "spelling": ") "
- },
- {
- "kind": "internalParam",
- "spelling": "Property"
- }
- ],
- "name": "Property"
- },
- {
- "declarationFragments": [
- {
- "kind": "text",
- "spelling": "("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:i",
- "spelling": "unsigned int"
- },
- {
- "kind": "text",
- "spelling": ") "
- },
- {
- "kind": "internalParam",
- "spelling": "Thing"
- }
- ],
- "name": "Thing"
- }
- ],
- "returns": [
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:v",
- "spelling": "void"
- }
- ]
- },
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(cs)Super(im)setProperty:andOtherThing:"
- },
- "kind": {
- "displayName": "Instance Method",
- "identifier": "objective-c.method"
- },
- "location": {
- "position": {
- "character": 0,
- "line": 5
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "setProperty:andOtherThing:"
- }
- ],
- "subHeading": [
- {
- "kind": "text",
- "spelling": "- "
- },
- {
- "kind": "identifier",
- "spelling": "setProperty:andOtherThing:"
- }
- ],
- "title": "setProperty:andOtherThing:"
- },
- "pathComponents": [
- "Super",
- "setProperty:andOtherThing:"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "@property"
- },
- {
- "kind": "text",
- "spelling": " ("
- },
- {
- "kind": "keyword",
- "spelling": "readonly"
- },
- {
- "kind": "text",
- "spelling": ", "
- },
- {
- "kind": "keyword",
- "spelling": "getter"
- },
- {
- "kind": "text",
- "spelling": "="
- },
- {
- "kind": "identifier",
- "spelling": "getProperty"
- },
- {
- "kind": "text",
- "spelling": ") "
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:i",
- "spelling": "unsigned int"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "Property"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(cs)Super(py)Property"
- },
- "kind": {
- "displayName": "Instance Property",
- "identifier": "objective-c.property"
- },
- "location": {
- "position": {
- "character": 49,
- "line": 3
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "Property"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "Property"
- }
- ],
- "title": "Property"
- },
- "pathComponents": [
- "Super",
- "Property"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "@interface"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "Derived"
- },
- {
- "kind": "text",
- "spelling": " : "
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:objc(cs)Super",
- "spelling": "Super"
- }
- ],
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(cs)Derived"
- },
- "kind": {
- "displayName": "Class",
- "identifier": "objective-c.class"
- },
- "location": {
- "position": {
- "character": 11,
- "line": 8
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "Derived"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "Derived"
- }
- ],
- "title": "Derived"
- },
- "pathComponents": [
- "Derived"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:C",
- "spelling": "char"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "Ivar"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(cs)Derived@Ivar"
- },
- "kind": {
- "displayName": "Instance Variable",
- "identifier": "objective-c.ivar"
- },
- "location": {
- "position": {
- "character": 7,
- "line": 9
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "Ivar"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "Ivar"
- }
- ],
- "title": "Ivar"
- },
- "pathComponents": [
- "Derived",
- "Ivar"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "text",
- "spelling": "- ("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:C",
- "spelling": "char"
- },
- {
- "kind": "text",
- "spelling": ") "
- },
- {
- "kind": "identifier",
- "spelling": "getIvar"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "functionSignature": {
- "returns": [
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:C",
- "spelling": "char"
- }
- ]
- },
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(cs)Derived(im)getIvar"
- },
- "kind": {
- "displayName": "Instance Method",
- "identifier": "objective-c.method"
- },
- "location": {
- "position": {
- "character": 0,
- "line": 11
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "getIvar"
- }
- ],
- "subHeading": [
- {
- "kind": "text",
- "spelling": "- "
- },
- {
- "kind": "identifier",
- "spelling": "getIvar"
- }
- ],
- "title": "getIvar"
- },
- "pathComponents": [
- "Derived",
- "getIvar"
- ]
- }
- ]
-}
+// expected-no-diagnostics
diff --git a/clang/test/ExtractAPI/objc_module_category.m b/clang/test/ExtractAPI/objc_module_category.m
deleted file mode 100644
index 708ed10..0000000
--- a/clang/test/ExtractAPI/objc_module_category.m
+++ /dev/null
@@ -1,404 +0,0 @@
-// RUN: rm -rf %t
-// RUN: split-file %s %t
-// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
-// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang -extract-api -x objective-c-header \
-// RUN: -target arm64-apple-macosx \
-// RUN: %t/input.h -o %t/output.json | FileCheck -allow-empty %s
-
-// Generator version is not consistent across test runs, normalize it.
-// RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \
-// RUN: %t/output.json >> %t/output-normalized.json
-// RUN: diff %t/reference.output.json %t/output-normalized.json
-
-// CHECK-NOT: error:
-// CHECK-NOT: warning:
-
-//--- input.h
-#import "Foundation.h"
-
-/// Doc comment 1
-@interface NSString (Category1)
--(void)method1;
-@end
-
-/// Doc comment 2
-@interface NSString (Category2)
--(void)method2;
-@end
-
-//--- Foundation.h
-@interface NSString
-@end
-
-//--- reference.output.json.in
-{
- "metadata": {
- "formatVersion": {
- "major": 0,
- "minor": 5,
- "patch": 3
- },
- "generator": "?"
- },
- "module": {
- "name": "",
- "platform": {
- "architecture": "arm64",
- "operatingSystem": {
- "minimumVersion": {
- "major": 11,
- "minor": 0,
- "patch": 0
- },
- "name": "macosx"
- },
- "vendor": "apple"
- }
- },
- "relationships": [
- {
- "kind": "extensionTo",
- "source": "c:objc(cy)NSString@Category1",
- "target": "c:objc(cs)NSString",
- "targetFallback": "NSString"
- },
- {
- "kind": "memberOf",
- "source": "c:objc(cs)NSString(im)method1",
- "target": "c:objc(cy)NSString@Category1",
- "targetFallback": "Category1"
- },
- {
- "kind": "extensionTo",
- "source": "c:objc(cy)NSString@Category2",
- "target": "c:objc(cs)NSString",
- "targetFallback": "NSString"
- },
- {
- "kind": "memberOf",
- "source": "c:objc(cs)NSString(im)method2",
- "target": "c:objc(cy)NSString@Category2",
- "targetFallback": "Category2"
- }
- ],
- "symbols": [
- {
- "accessLevel": "public",
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(cy)NSString@Category1"
- },
- "kind": {
- "displayName": "Module Extension",
- "identifier": "objective-c.module.extension"
- }
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "@interface"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:objc(cs)NSString",
- "spelling": "NSString"
- },
- {
- "kind": "text",
- "spelling": " ("
- },
- {
- "kind": "identifier",
- "spelling": "Category1"
- },
- {
- "kind": "text",
- "spelling": ")"
- }
- ],
- "docComment": {
- "lines": [
- {
- "range": {
- "end": {
- "character": 17,
- "line": 2
- },
- "start": {
- "character": 4,
- "line": 2
- }
- },
- "text": "Doc comment 1"
- }
- ]
- },
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(cy)NSString@Category1"
- },
- "kind": {
- "displayName": "Class Extension",
- "identifier": "objective-c.class.extension"
- },
- "location": {
- "position": {
- "character": 11,
- "line": 3
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "Category1"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "Category1"
- }
- ],
- "title": "NSString (Category1)"
- },
- "pathComponents": [
- "Category1"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "text",
- "spelling": "- ("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:v",
- "spelling": "void"
- },
- {
- "kind": "text",
- "spelling": ") "
- },
- {
- "kind": "identifier",
- "spelling": "method1"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "functionSignature": {
- "returns": [
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:v",
- "spelling": "void"
- }
- ]
- },
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(cs)NSString(im)method1"
- },
- "kind": {
- "displayName": "Instance Method",
- "identifier": "objective-c.method"
- },
- "location": {
- "position": {
- "character": 0,
- "line": 4
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "method1"
- }
- ],
- "subHeading": [
- {
- "kind": "text",
- "spelling": "- "
- },
- {
- "kind": "identifier",
- "spelling": "method1"
- }
- ],
- "title": "method1"
- },
- "pathComponents": [
- "Category1",
- "method1"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "@interface"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:objc(cs)NSString",
- "spelling": "NSString"
- },
- {
- "kind": "text",
- "spelling": " ("
- },
- {
- "kind": "identifier",
- "spelling": "Category2"
- },
- {
- "kind": "text",
- "spelling": ")"
- }
- ],
- "docComment": {
- "lines": [
- {
- "range": {
- "end": {
- "character": 17,
- "line": 7
- },
- "start": {
- "character": 4,
- "line": 7
- }
- },
- "text": "Doc comment 2"
- }
- ]
- },
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(cy)NSString@Category2"
- },
- "kind": {
- "displayName": "Class Extension",
- "identifier": "objective-c.class.extension"
- },
- "location": {
- "position": {
- "character": 11,
- "line": 8
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "Category2"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "Category2"
- }
- ],
- "title": "NSString (Category2)"
- },
- "pathComponents": [
- "Category2"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "text",
- "spelling": "- ("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:v",
- "spelling": "void"
- },
- {
- "kind": "text",
- "spelling": ") "
- },
- {
- "kind": "identifier",
- "spelling": "method2"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "functionSignature": {
- "returns": [
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:v",
- "spelling": "void"
- }
- ]
- },
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(cs)NSString(im)method2"
- },
- "kind": {
- "displayName": "Instance Method",
- "identifier": "objective-c.method"
- },
- "location": {
- "position": {
- "character": 0,
- "line": 9
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "method2"
- }
- ],
- "subHeading": [
- {
- "kind": "text",
- "spelling": "- "
- },
- {
- "kind": "identifier",
- "spelling": "method2"
- }
- ],
- "title": "method2"
- },
- "pathComponents": [
- "Category2",
- "method2"
- ]
- }
- ]
-}
diff --git a/clang/test/ExtractAPI/objc_property.m b/clang/test/ExtractAPI/objc_property.m
index 5712abc..f05584c 100644
--- a/clang/test/ExtractAPI/objc_property.m
+++ b/clang/test/ExtractAPI/objc_property.m
@@ -1,608 +1,26 @@
// RUN: rm -rf %t
-// RUN: split-file %s %t
-// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
-// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang_cc1 -extract-api -triple arm64-apple-macosx -x objective-c-header %t/input.h -o %t/output.json -verify
+// RUN: %clang_cc1 -extract-api --pretty-sgf --emit-sgf-symbol-labels-for-testing \
+// RUN: -triple arm64-apple-macosx -x objective-c-header %s -o - -verify | FileCheck %s
-// Generator version is not consistent across test runs, normalize it.
-// RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \
-// RUN: %t/output.json >> %t/output-normalized.json
-// RUN: diff %t/reference.output.json %t/output-normalized.json
-
-//--- input.h
@protocol Protocol
@property(class) int myProtocolTypeProp;
+// CHECK-DAG: "!testRelLabel": "memberOf $ c:objc(pl)Protocol(cpy)myProtocolTypeProp $ c:objc(pl)Protocol"
@property int myProtocolInstanceProp;
+// CHECK-DAG: "!testRelLabel": "memberOf $ c:objc(pl)Protocol(py)myProtocolInstanceProp $ c:objc(pl)Protocol"
@end
@interface Interface
@property(class) int myInterfaceTypeProp;
+// CHECk-DAG: "!testRelLabel": "memberOf $ c:objc(cs)Interface(cpy)myInterfaceTypeProp $ c:objc(cs)Interface"
@property int myInterfaceInstanceProp;
+// CHECK-DAG: "!testRelLabel": "memberOf $ c:objc(cs)Interface(py)myInterfaceInstanceProp $ c:objc(cs)Interface"
@end
@interface Interface (Category) <Protocol>
@property(class) int myCategoryTypeProp;
+// CHECK-DAG: "!testRelLabel": "memberOf $ c:objc(cs)Interface(cpy)myCategoryTypeProp $ c:objc(cs)Interface"
@property int myCategoryInstanceProp;
+// CHECK-DAG "!testRelLabel": "memberOf $ c:objc(cs)Interface(py)myCategoryInstanceProp $ c:objc(cs)Interface"
@end
-// expected-no-diagnostics
-//--- reference.output.json.in
-{
- "metadata": {
- "formatVersion": {
- "major": 0,
- "minor": 5,
- "patch": 3
- },
- "generator": "?"
- },
- "module": {
- "name": "",
- "platform": {
- "architecture": "arm64",
- "operatingSystem": {
- "minimumVersion": {
- "major": 11,
- "minor": 0,
- "patch": 0
- },
- "name": "macosx"
- },
- "vendor": "apple"
- }
- },
- "relationships": [
- {
- "kind": "memberOf",
- "source": "c:objc(cs)Interface(cpy)myInterfaceTypeProp",
- "target": "c:objc(cs)Interface",
- "targetFallback": "Interface"
- },
- {
- "kind": "memberOf",
- "source": "c:objc(cs)Interface(py)myInterfaceInstanceProp",
- "target": "c:objc(cs)Interface",
- "targetFallback": "Interface"
- },
- {
- "kind": "memberOf",
- "source": "c:objc(cs)Interface(cpy)myCategoryTypeProp",
- "target": "c:objc(cs)Interface",
- "targetFallback": "Interface"
- },
- {
- "kind": "memberOf",
- "source": "c:objc(cs)Interface(py)myCategoryInstanceProp",
- "target": "c:objc(cs)Interface",
- "targetFallback": "Interface"
- },
- {
- "kind": "conformsTo",
- "source": "c:objc(cs)Interface",
- "target": "c:objc(pl)Protocol",
- "targetFallback": "Protocol"
- },
- {
- "kind": "memberOf",
- "source": "c:objc(pl)Protocol(cpy)myProtocolTypeProp",
- "target": "c:objc(pl)Protocol",
- "targetFallback": "Protocol"
- },
- {
- "kind": "memberOf",
- "source": "c:objc(pl)Protocol(py)myProtocolInstanceProp",
- "target": "c:objc(pl)Protocol",
- "targetFallback": "Protocol"
- }
- ],
- "symbols": [
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "@interface"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "Interface"
- }
- ],
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(cs)Interface"
- },
- "kind": {
- "displayName": "Class",
- "identifier": "objective-c.class"
- },
- "location": {
- "position": {
- "character": 11,
- "line": 5
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "Interface"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "Interface"
- }
- ],
- "title": "Interface"
- },
- "pathComponents": [
- "Interface"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "@property"
- },
- {
- "kind": "text",
- "spelling": " ("
- },
- {
- "kind": "keyword",
- "spelling": "class"
- },
- {
- "kind": "text",
- "spelling": ") "
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "myInterfaceTypeProp"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(cs)Interface(cpy)myInterfaceTypeProp"
- },
- "kind": {
- "displayName": "Type Property",
- "identifier": "objective-c.type.property"
- },
- "location": {
- "position": {
- "character": 21,
- "line": 6
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "myInterfaceTypeProp"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "myInterfaceTypeProp"
- }
- ],
- "title": "myInterfaceTypeProp"
- },
- "pathComponents": [
- "Interface",
- "myInterfaceTypeProp"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "@property"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "myInterfaceInstanceProp"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(cs)Interface(py)myInterfaceInstanceProp"
- },
- "kind": {
- "displayName": "Instance Property",
- "identifier": "objective-c.property"
- },
- "location": {
- "position": {
- "character": 14,
- "line": 7
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "myInterfaceInstanceProp"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "myInterfaceInstanceProp"
- }
- ],
- "title": "myInterfaceInstanceProp"
- },
- "pathComponents": [
- "Interface",
- "myInterfaceInstanceProp"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "@property"
- },
- {
- "kind": "text",
- "spelling": " ("
- },
- {
- "kind": "keyword",
- "spelling": "class"
- },
- {
- "kind": "text",
- "spelling": ") "
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "myCategoryTypeProp"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(cs)Interface(cpy)myCategoryTypeProp"
- },
- "kind": {
- "displayName": "Type Property",
- "identifier": "objective-c.type.property"
- },
- "location": {
- "position": {
- "character": 21,
- "line": 11
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "myCategoryTypeProp"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "myCategoryTypeProp"
- }
- ],
- "title": "myCategoryTypeProp"
- },
- "pathComponents": [
- "Interface",
- "myCategoryTypeProp"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "@property"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "myCategoryInstanceProp"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(cs)Interface(py)myCategoryInstanceProp"
- },
- "kind": {
- "displayName": "Instance Property",
- "identifier": "objective-c.property"
- },
- "location": {
- "position": {
- "character": 14,
- "line": 12
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "myCategoryInstanceProp"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "myCategoryInstanceProp"
- }
- ],
- "title": "myCategoryInstanceProp"
- },
- "pathComponents": [
- "Interface",
- "myCategoryInstanceProp"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "@protocol"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "Protocol"
- }
- ],
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(pl)Protocol"
- },
- "kind": {
- "displayName": "Protocol",
- "identifier": "objective-c.protocol"
- },
- "location": {
- "position": {
- "character": 10,
- "line": 0
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "Protocol"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "Protocol"
- }
- ],
- "title": "Protocol"
- },
- "pathComponents": [
- "Protocol"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "@property"
- },
- {
- "kind": "text",
- "spelling": " ("
- },
- {
- "kind": "keyword",
- "spelling": "class"
- },
- {
- "kind": "text",
- "spelling": ") "
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "myProtocolTypeProp"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(pl)Protocol(cpy)myProtocolTypeProp"
- },
- "kind": {
- "displayName": "Type Property",
- "identifier": "objective-c.type.property"
- },
- "location": {
- "position": {
- "character": 21,
- "line": 1
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "myProtocolTypeProp"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "myProtocolTypeProp"
- }
- ],
- "title": "myProtocolTypeProp"
- },
- "pathComponents": [
- "Protocol",
- "myProtocolTypeProp"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "@property"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "myProtocolInstanceProp"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(pl)Protocol(py)myProtocolInstanceProp"
- },
- "kind": {
- "displayName": "Instance Property",
- "identifier": "objective-c.property"
- },
- "location": {
- "position": {
- "character": 14,
- "line": 2
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "myProtocolInstanceProp"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "myProtocolInstanceProp"
- }
- ],
- "title": "myProtocolInstanceProp"
- },
- "pathComponents": [
- "Protocol",
- "myProtocolInstanceProp"
- ]
- }
- ]
-}
+// expected-no-diagnostics
diff --git a/clang/test/ExtractAPI/objc_protocol.m b/clang/test/ExtractAPI/objc_protocol.m
index a04936f..06f7ee3 100644
--- a/clang/test/ExtractAPI/objc_protocol.m
+++ b/clang/test/ExtractAPI/objc_protocol.m
@@ -2,7 +2,7 @@
// RUN: split-file %s %t
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang -extract-api -x objective-c-header -target arm64-apple-macosx \
+// RUN: %clang -extract-api --pretty-sgf -x objective-c-header -target arm64-apple-macosx \
// RUN: %t/input.h -o %t/output.json | FileCheck -allow-empty %s
// Generator version is not consistent across test runs, normalize it.
diff --git a/clang/test/ExtractAPI/objc_various_categories.m b/clang/test/ExtractAPI/objc_various_categories.m
deleted file mode 100644
index adaef5a..0000000
--- a/clang/test/ExtractAPI/objc_various_categories.m
+++ /dev/null
@@ -1,507 +0,0 @@
-// RUN: rm -rf %t
-// RUN: split-file %s %t
-// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
-// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang -extract-api -x objective-c-header \
-// RUN: -target arm64-apple-macosx \
-// RUN: %t/myclass_1.h \
-// RUN: %t/input.h -o %t/output.json | FileCheck -allow-empty %s
-
-// Generator version is not consistent across test runs, normalize it.
-// RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \
-// RUN: %t/output.json >> %t/output-normalized.json
-// RUN: diff %t/reference.output.json %t/output-normalized.json
-
-// CHECK-NOT: error:
-// CHECK-NOT: warning:
-
-//--- input.h
-#import "myclass_1.h"
-#import "Foundation.h"
-
-@interface MyClass1 (MyCategory1)
-- (int) SomeMethod;
-@end
-
-@interface NSString (Category1)
--(void) StringMethod;
-@end
-
-@interface NSString (Category2)
--(void) StringMethod2;
-@end
-
-//--- myclass_1.h
-@interface MyClass1
-@end
-
-//--- Foundation.h
-@interface NSString
-@end
-
-//--- reference.output.json.in
-{
- "metadata": {
- "formatVersion": {
- "major": 0,
- "minor": 5,
- "patch": 3
- },
- "generator": "?"
- },
- "module": {
- "name": "",
- "platform": {
- "architecture": "arm64",
- "operatingSystem": {
- "minimumVersion": {
- "major": 11,
- "minor": 0,
- "patch": 0
- },
- "name": "macosx"
- },
- "vendor": "apple"
- }
- },
- "relationships": [
- {
- "kind": "memberOf",
- "source": "c:objc(cs)MyClass1(im)SomeMethod",
- "target": "c:objc(cs)MyClass1",
- "targetFallback": "MyClass1"
- },
- {
- "kind": "extensionTo",
- "source": "c:objc(cy)NSString@Category1",
- "target": "c:objc(cs)NSString",
- "targetFallback": "NSString"
- },
- {
- "kind": "memberOf",
- "source": "c:objc(cs)NSString(im)StringMethod",
- "target": "c:objc(cy)NSString@Category1",
- "targetFallback": "Category1"
- },
- {
- "kind": "extensionTo",
- "source": "c:objc(cy)NSString@Category2",
- "target": "c:objc(cs)NSString",
- "targetFallback": "NSString"
- },
- {
- "kind": "memberOf",
- "source": "c:objc(cs)NSString(im)StringMethod2",
- "target": "c:objc(cy)NSString@Category2",
- "targetFallback": "Category2"
- }
- ],
- "symbols": [
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "@interface"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "MyClass1"
- }
- ],
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(cs)MyClass1"
- },
- "kind": {
- "displayName": "Class",
- "identifier": "objective-c.class"
- },
- "location": {
- "position": {
- "character": 11,
- "line": 0
- },
- "uri": "file://INPUT_DIR/myclass_1.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "MyClass1"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "MyClass1"
- }
- ],
- "title": "MyClass1"
- },
- "pathComponents": [
- "MyClass1"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "text",
- "spelling": "- ("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- },
- {
- "kind": "text",
- "spelling": ") "
- },
- {
- "kind": "identifier",
- "spelling": "SomeMethod"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "functionSignature": {
- "returns": [
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- }
- ]
- },
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(cs)MyClass1(im)SomeMethod"
- },
- "kind": {
- "displayName": "Instance Method",
- "identifier": "objective-c.method"
- },
- "location": {
- "position": {
- "character": 0,
- "line": 4
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "SomeMethod"
- }
- ],
- "subHeading": [
- {
- "kind": "text",
- "spelling": "- "
- },
- {
- "kind": "identifier",
- "spelling": "SomeMethod"
- }
- ],
- "title": "SomeMethod"
- },
- "pathComponents": [
- "MyClass1",
- "SomeMethod"
- ]
- },
- {
- "accessLevel": "public",
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(cy)NSString@Category1"
- },
- "kind": {
- "displayName": "Module Extension",
- "identifier": "objective-c.module.extension"
- }
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "@interface"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:objc(cs)NSString",
- "spelling": "NSString"
- },
- {
- "kind": "text",
- "spelling": " ("
- },
- {
- "kind": "identifier",
- "spelling": "Category1"
- },
- {
- "kind": "text",
- "spelling": ")"
- }
- ],
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(cy)NSString@Category1"
- },
- "kind": {
- "displayName": "Class Extension",
- "identifier": "objective-c.class.extension"
- },
- "location": {
- "position": {
- "character": 11,
- "line": 7
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "Category1"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "Category1"
- }
- ],
- "title": "NSString (Category1)"
- },
- "pathComponents": [
- "Category1"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "text",
- "spelling": "- ("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:v",
- "spelling": "void"
- },
- {
- "kind": "text",
- "spelling": ") "
- },
- {
- "kind": "identifier",
- "spelling": "StringMethod"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "functionSignature": {
- "returns": [
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:v",
- "spelling": "void"
- }
- ]
- },
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(cs)NSString(im)StringMethod"
- },
- "kind": {
- "displayName": "Instance Method",
- "identifier": "objective-c.method"
- },
- "location": {
- "position": {
- "character": 0,
- "line": 8
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "StringMethod"
- }
- ],
- "subHeading": [
- {
- "kind": "text",
- "spelling": "- "
- },
- {
- "kind": "identifier",
- "spelling": "StringMethod"
- }
- ],
- "title": "StringMethod"
- },
- "pathComponents": [
- "Category1",
- "StringMethod"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "@interface"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:objc(cs)NSString",
- "spelling": "NSString"
- },
- {
- "kind": "text",
- "spelling": " ("
- },
- {
- "kind": "identifier",
- "spelling": "Category2"
- },
- {
- "kind": "text",
- "spelling": ")"
- }
- ],
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(cy)NSString@Category2"
- },
- "kind": {
- "displayName": "Class Extension",
- "identifier": "objective-c.class.extension"
- },
- "location": {
- "position": {
- "character": 11,
- "line": 11
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "Category2"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "Category2"
- }
- ],
- "title": "NSString (Category2)"
- },
- "pathComponents": [
- "Category2"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "text",
- "spelling": "- ("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:v",
- "spelling": "void"
- },
- {
- "kind": "text",
- "spelling": ") "
- },
- {
- "kind": "identifier",
- "spelling": "StringMethod2"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "functionSignature": {
- "returns": [
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:v",
- "spelling": "void"
- }
- ]
- },
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:objc(cs)NSString(im)StringMethod2"
- },
- "kind": {
- "displayName": "Instance Method",
- "identifier": "objective-c.method"
- },
- "location": {
- "position": {
- "character": 0,
- "line": 12
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "StringMethod2"
- }
- ],
- "subHeading": [
- {
- "kind": "text",
- "spelling": "- "
- },
- {
- "kind": "identifier",
- "spelling": "StringMethod2"
- }
- ],
- "title": "StringMethod2"
- },
- "pathComponents": [
- "Category2",
- "StringMethod2"
- ]
- }
- ]
-}
diff --git a/clang/test/ExtractAPI/operator_overload.cpp b/clang/test/ExtractAPI/operator_overload.cpp
index 511a5a7..9430c58 100644
--- a/clang/test/ExtractAPI/operator_overload.cpp
+++ b/clang/test/ExtractAPI/operator_overload.cpp
@@ -2,7 +2,7 @@
// RUN: split-file %s %t
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang_cc1 -extract-api -triple arm64-apple-macosx \
+// RUN: %clang_cc1 -extract-api --pretty-sgf -triple arm64-apple-macosx \
// RUN: -x c++-header %t/input.h -o %t/output.json -verify
// Generator version is not consistent across test runs, normalize it.
diff --git a/clang/test/ExtractAPI/relative_include.m b/clang/test/ExtractAPI/relative_include.m
index 46cbdaee..e5a0268 100644
--- a/clang/test/ExtractAPI/relative_include.m
+++ b/clang/test/ExtractAPI/relative_include.m
@@ -15,7 +15,7 @@
// RUN: %hmaptool write %t/headermap.hmap.json %t/headermap.hmap
// Input headers use paths to the framework root/DSTROOT
-// RUN: %clang_cc1 -extract-api -v --product-name=MyFramework \
+// RUN: %clang_cc1 -extract-api --pretty-sgf -v --product-name=MyFramework \
// RUN: -triple arm64-apple-macosx \
// RUN: -iquote%t -I%t/headermap.hmap -F%t/Frameworks \
// RUN: -x objective-c-header \
diff --git a/clang/test/ExtractAPI/simple_inheritance.cpp b/clang/test/ExtractAPI/simple_inheritance.cpp
index 5fe99af..58c3c4e 100644
--- a/clang/test/ExtractAPI/simple_inheritance.cpp
+++ b/clang/test/ExtractAPI/simple_inheritance.cpp
@@ -2,7 +2,7 @@
// RUN: split-file %s %t
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang_cc1 -extract-api -triple arm64-apple-macosx \
+// RUN: %clang_cc1 -extract-api --pretty-sgf -triple arm64-apple-macosx \
// RUN: -x c++-header %t/input.h -o %t/output.json -verify
// Generator version is not consistent across test runs, normalize it.
diff --git a/clang/test/ExtractAPI/struct.c b/clang/test/ExtractAPI/struct.c
index 4284b73..1995a6ae 100644
--- a/clang/test/ExtractAPI/struct.c
+++ b/clang/test/ExtractAPI/struct.c
@@ -2,7 +2,7 @@
// RUN: split-file %s %t
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang -extract-api -target arm64-apple-macosx \
+// RUN: %clang -extract-api --pretty-sgf -target arm64-apple-macosx \
// RUN: %t/input.h -o %t/output.json | FileCheck -allow-empty %s
// Generator version is not consistent across test runs, normalize it.
diff --git a/clang/test/ExtractAPI/typedef.c b/clang/test/ExtractAPI/typedef.c
index c30e655..a4c3619 100644
--- a/clang/test/ExtractAPI/typedef.c
+++ b/clang/test/ExtractAPI/typedef.c
@@ -1,391 +1,93 @@
// RUN: rm -rf %t
-// RUN: split-file %s %t
-// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
-// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang -extract-api --product-name=Typedef -target arm64-apple-macosx \
-// RUN: -x objective-c-header %t/input.h -o %t/output.json | FileCheck -allow-empty %s
+// RUN: %clang_cc1 -extract-api --pretty-sgf --emit-sgf-symbol-labels-for-testing \
+// RUN: -triple arm64-apple-macosx -x objective-c-header %s -o %t/output.symbols.json -verify
-// Generator version is not consistent across test runs, normalize it.
-// RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \
-// RUN: %t/output.json >> %t/output-normalized.json
-// RUN: diff %t/reference.output.json %t/output-normalized.json
-
-// CHECK-NOT: error:
-// CHECK-NOT: warning:
-
-//--- input.h
+// RUN: FileCheck %s --input-file %t/output.symbols.json --check-prefix MYINT
typedef int MyInt;
+// MYINT-LABEL: "!testLabel": "c:typedef.c@T@MyInt"
+// MYINT: "accessLevel": "public",
+// MYINT: "declarationFragments": [
+// MYINT-NEXT: {
+// MYINT-NEXT: "kind": "keyword",
+// MYINT-NEXT: "spelling": "typedef"
+// MYINT-NEXT: },
+// MYINT-NEXT: {
+// MYINT-NEXT: "kind": "text",
+// MYINT-NEXT: "spelling": " "
+// MYINT-NEXT: },
+// MYINT-NEXT: {
+// MYINT-NEXT: "kind": "typeIdentifier",
+// MYINT-NEXT: "preciseIdentifier": "c:I",
+// MYINT-NEXT: "spelling": "int"
+// MYINT-NEXT: },
+// MYINT-NEXT: {
+// MYINT-NEXT: "kind": "text",
+// MYINT-NEXT: "spelling": " "
+// MYINT-NEXT: },
+// MYINT-NEXT: {
+// MYINT-NEXT: "kind": "identifier",
+// MYINT-NEXT: "spelling": "MyInt"
+// MYINT-NEXT: },
+// MYINT-NEXT: {
+// MYINT-NEXT: "kind": "text",
+// MYINT-NEXT: "spelling": ";"
+// MYINT-NEXT: }
+// MYINT-NEXT: ],
+// MYINT: "kind": {
+// MYINT-NEXT: "displayName": "Type Alias",
+// MYINT-NEXT: "identifier": "objective-c.typealias"
+// MYINT-NEXT: },
+// MYINT: "title": "MyInt"
+// MYINT: "pathComponents": [
+// MYINT-NEXT: "MyInt"
+// MYINT-NEXT: ],
+// MYINT: "type": "c:I"
+// RUN: FileCheck %s --input-file %t/output.symbols.json --check-prefix BARPTR
typedef struct Bar *BarPtr;
+// BARPTR-LABEL: "!testLabel": "c:typedef.c@T@BarPtr"
+// BARPTR: "accessLevel": "public",
+// BARPTR: "declarationFragments": [
+// BARPTR-NEXT: {
+// BARPTR-NEXT: "kind": "keyword",
+// BARPTR-NEXT: "spelling": "typedef"
+// BARPTR-NEXT: },
+// BARPTR-NEXT: {
+// BARPTR-NEXT: "kind": "text",
+// BARPTR-NEXT: "spelling": " "
+// BARPTR-NEXT: },
+// BARPTR-NEXT: {
+// BARPTR-NEXT: "kind": "keyword",
+// BARPTR-NEXT: "spelling": "struct"
+// BARPTR-NEXT: },
+// BARPTR-NEXT: {
+// BARPTR-NEXT: "kind": "text",
+// BARPTR-NEXT: "spelling": " "
+// BARPTR-NEXT: },
+// BARPTR-NEXT: {
+// BARPTR-NEXT: "kind": "typeIdentifier",
+// BARPTR-NEXT: "preciseIdentifier": "c:@S@Bar",
+// BARPTR-NEXT: "spelling": "Bar"
+// BARPTR-NEXT: },
+// BARPTR-NEXT: {
+// BARPTR-NEXT: "kind": "text",
+// BARPTR-NEXT: "spelling": " * "
+// BARPTR-NEXT: },
+// BARPTR-NEXT: {
+// BARPTR-NEXT: "kind": "identifier",
+// BARPTR-NEXT: "spelling": "BarPtr"
+// BARPTR-NEXT: },
+// BARPTR-NEXT: {
+// BARPTR-NEXT: "kind": "text",
+// BARPTR-NEXT: "spelling": ";"
+// BARPTR-NEXT: }
+// BARPTR-NEXT: ],
+// BARPTR: "type": "c:*$@S@Bar"
+// RUN: FileCheck %s --input-file %t/output.symbols.json
void foo(BarPtr value);
void baz(BarPtr *value);
+// CHECK-NOT: struct Bar *
-//--- reference.output.json.in
-{
- "metadata": {
- "formatVersion": {
- "major": 0,
- "minor": 5,
- "patch": 3
- },
- "generator": "?"
- },
- "module": {
- "name": "Typedef",
- "platform": {
- "architecture": "arm64",
- "operatingSystem": {
- "minimumVersion": {
- "major": 11,
- "minor": 0,
- "patch": 0
- },
- "name": "macosx"
- },
- "vendor": "apple"
- }
- },
- "relationships": [],
- "symbols": [
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:v",
- "spelling": "void"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "foo"
- },
- {
- "kind": "text",
- "spelling": "("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:input.h@T@BarPtr",
- "spelling": "BarPtr"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "internalParam",
- "spelling": "value"
- },
- {
- "kind": "text",
- "spelling": ");"
- }
- ],
- "functionSignature": {
- "parameters": [
- {
- "declarationFragments": [
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:input.h@T@BarPtr",
- "spelling": "BarPtr"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "internalParam",
- "spelling": "value"
- }
- ],
- "name": "value"
- }
- ],
- "returns": [
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:v",
- "spelling": "void"
- }
- ]
- },
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:@F@foo"
- },
- "kind": {
- "displayName": "Function",
- "identifier": "objective-c.func"
- },
- "location": {
- "position": {
- "character": 5,
- "line": 4
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "foo"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "foo"
- }
- ],
- "title": "foo"
- },
- "pathComponents": [
- "foo"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:v",
- "spelling": "void"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "baz"
- },
- {
- "kind": "text",
- "spelling": "("
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:input.h@T@BarPtr",
- "spelling": "BarPtr"
- },
- {
- "kind": "text",
- "spelling": " * "
- },
- {
- "kind": "internalParam",
- "spelling": "value"
- },
- {
- "kind": "text",
- "spelling": ");"
- }
- ],
- "functionSignature": {
- "parameters": [
- {
- "declarationFragments": [
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:input.h@T@BarPtr",
- "spelling": "BarPtr"
- },
- {
- "kind": "text",
- "spelling": " * "
- },
- {
- "kind": "internalParam",
- "spelling": "value"
- }
- ],
- "name": "value"
- }
- ],
- "returns": [
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:v",
- "spelling": "void"
- }
- ]
- },
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:@F@baz"
- },
- "kind": {
- "displayName": "Function",
- "identifier": "objective-c.func"
- },
- "location": {
- "position": {
- "character": 5,
- "line": 6
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "baz"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "baz"
- }
- ],
- "title": "baz"
- },
- "pathComponents": [
- "baz"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "typedef"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "MyInt"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:input.h@T@MyInt"
- },
- "kind": {
- "displayName": "Type Alias",
- "identifier": "objective-c.typealias"
- },
- "location": {
- "position": {
- "character": 12,
- "line": 0
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "MyInt"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "MyInt"
- }
- ],
- "title": "MyInt"
- },
- "pathComponents": [
- "MyInt"
- ],
- "type": "c:I"
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "typedef"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "keyword",
- "spelling": "struct"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:@S@Bar",
- "spelling": "Bar"
- },
- {
- "kind": "text",
- "spelling": " * "
- },
- {
- "kind": "identifier",
- "spelling": "BarPtr"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "identifier": {
- "interfaceLanguage": "objective-c",
- "precise": "c:input.h@T@BarPtr"
- },
- "kind": {
- "displayName": "Type Alias",
- "identifier": "objective-c.typealias"
- },
- "location": {
- "position": {
- "character": 20,
- "line": 2
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "BarPtr"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "BarPtr"
- }
- ],
- "title": "BarPtr"
- },
- "pathComponents": [
- "BarPtr"
- ],
- "type": "c:*$@S@Bar"
- }
- ]
-}
+// expected-no-diagnostics
diff --git a/clang/test/ExtractAPI/typedef_anonymous_record.c b/clang/test/ExtractAPI/typedef_anonymous_record.c
index 3e4c3e1..9e00ff7 100644
--- a/clang/test/ExtractAPI/typedef_anonymous_record.c
+++ b/clang/test/ExtractAPI/typedef_anonymous_record.c
@@ -1,468 +1,158 @@
// RUN: rm -rf %t
-// RUN: split-file %s %t
-// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
-// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang_cc1 -extract-api --product-name=TypedefChain -triple arm64-apple-macosx \
-// RUN: -x c-header %t/input.h -o %t/output.json -verify
+// RUN: %clang_cc1 -extract-api --pretty-sgf --emit-sgf-symbol-labels-for-testing \
+// RUN: --product-name=TypedefChain -triple arm64-apple-macosx -x c-header %s -o %t/typedefchain.symbols.json -verify
-// Generator version is not consistent across test runs, normalize it.
-// RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \
-// RUN: %t/output.json >> %t/output-normalized.json
-// RUN: diff %t/reference.output.json %t/output-normalized.json
-
-//--- input.h
+// RUN: FileCheck %s --input-file %t/typedefchain.symbols.json --check-prefix MYSTRUCT
typedef struct { } MyStruct;
+// MYSTRUCT-LABEL: "!testLabel": "c:@SA@MyStruct"
+// MYSTRUCT: "accessLevel": "public",
+// MYSTRUCT: "declarationFragments": [
+// MYSTRUCT-NEXT: {
+// MYSTRUCT-NEXT: "kind": "keyword",
+// MYSTRUCT-NEXT: "spelling": "typedef"
+// MYSTRUCT-NEXT: },
+// MYSTRUCT-NEXT: {
+// MYSTRUCT-NEXT: "kind": "text",
+// MYSTRUCT-NEXT: "spelling": " "
+// MYSTRUCT-NEXT: },
+// MYSTRUCT-NEXT: {
+// MYSTRUCT-NEXT: "kind": "keyword",
+// MYSTRUCT-NEXT: "spelling": "struct"
+// MYSTRUCT-NEXT: },
+// MYSTRUCT-NEXT: {
+// MYSTRUCT-NEXT: "kind": "text",
+// MYSTRUCT-NEXT: "spelling": " "
+// MYSTRUCT-NEXT: },
+// MYSTRUCT-NEXT: {
+// MYSTRUCT-NEXT: "kind": "identifier",
+// MYSTRUCT-NEXT: "spelling": "MyStruct"
+// MYSTRUCT-NEXT: },
+// MYSTRUCT-NEXT: {
+// MYSTRUCT-NEXT: "kind": "text",
+// MYSTRUCT-NEXT: "spelling": ";"
+// MYSTRUCT-NEXT: }
+// MYSTRUCT-NEXT: ]
+// MYSTRUCT: "kind": {
+// MYSTRUCT-NEXT: "displayName": "Structure",
+// MYSTRUCT-NEXT: "identifier": "c.struct"
+// MYSTRUCT: "title": "MyStruct"
+// MYSTRUCT: "pathComponents": [
+// MYSTRUCT-NEXT: "MyStruct"
+// MYSTRUCT-NEXT: ]
+
+// RUN: FileCheck %s --input-file %t/typedefchain.symbols.json --check-prefix MYSTRUCTSTRUCT
typedef MyStruct MyStructStruct;
-typedef MyStructStruct MyStructStructStruct;
+// MYSTRUCTSTRUCT-LABEL: "!testLabel": "c:typedef_anonymous_record.c@T@MyStructStruct"
+// MYSTRUCTSTRUCT: "accessLevel": "public",
+// MYSTRUCTSTRUCT: "declarationFragments": [
+// MYSTRUCTSTRUCT-NEXT: {
+// MYSTRUCTSTRUCT-NEXT: "kind": "keyword",
+// MYSTRUCTSTRUCT-NEXT: "spelling": "typedef"
+// MYSTRUCTSTRUCT-NEXT: },
+// MYSTRUCTSTRUCT-NEXT: {
+// MYSTRUCTSTRUCT-NEXT: "kind": "text",
+// MYSTRUCTSTRUCT-NEXT: "spelling": " "
+// MYSTRUCTSTRUCT-NEXT: },
+// MYSTRUCTSTRUCT-NEXT: {
+// MYSTRUCTSTRUCT-NEXT: "kind": "typeIdentifier",
+// MYSTRUCTSTRUCT-NEXT: "preciseIdentifier": "c:@SA@MyStruct",
+// MYSTRUCTSTRUCT-NEXT: "spelling": "MyStruct"
+// MYSTRUCTSTRUCT-NEXT: },
+// MYSTRUCTSTRUCT-NEXT: {
+// MYSTRUCTSTRUCT-NEXT: "kind": "text",
+// MYSTRUCTSTRUCT-NEXT: "spelling": " "
+// MYSTRUCTSTRUCT-NEXT: },
+// MYSTRUCTSTRUCT-NEXT: {
+// MYSTRUCTSTRUCT-NEXT: "kind": "identifier",
+// MYSTRUCTSTRUCT-NEXT: "spelling": "MyStructStruct"
+// MYSTRUCTSTRUCT-NEXT: },
+// MYSTRUCTSTRUCT-NEXT: {
+// MYSTRUCTSTRUCT-NEXT: "kind": "text",
+// MYSTRUCTSTRUCT-NEXT: "spelling": ";"
+// MYSTRUCTSTRUCT-NEXT: }
+// MYSTRUCTSTRUCT-NEXT:],
+// MYSTRUCTSTRUCT: "kind": {
+// MYSTRUCTSTRUCT-NEXT: "displayName": "Type Alias",
+// MYSTRUCTSTRUCT-NEXT: "identifier": "c.typealias"
+
+// RUN: FileCheck %s --input-file %t/typedefchain.symbols.json --check-prefix MYENUM
+// RUN: FileCheck %s --input-file %t/typedefchain.symbols.json --check-prefix CASE
typedef enum { Case } MyEnum;
+// MYENUM: "source": "c:@EA@MyEnum@Case",
+// MYENUM-NEXT: "target": "c:@EA@MyEnum",
+// MYENUM-NEXT: "targetFallback": "MyEnum"
+// MYENUM-LABEL: "!testLabel": "c:@EA@MyEnum"
+// MYENUM: "declarationFragments": [
+// MYENUM-NEXT: {
+// MYENUM-NEXT: "kind": "keyword",
+// MYENUM-NEXT: "spelling": "typedef"
+// MYENUM-NEXT: },
+// MYENUM-NEXT: {
+// MYENUM-NEXT: "kind": "text",
+// MYENUM-NEXT: "spelling": " "
+// MYENUM-NEXT: },
+// MYENUM-NEXT: {
+// MYENUM-NEXT: "kind": "keyword",
+// MYENUM-NEXT: "spelling": "enum"
+// MYENUM-NEXT: },
+// MYENUM-NEXT: {
+// MYENUM-NEXT: "kind": "text",
+// MYENUM-NEXT: "spelling": " "
+// MYENUM-NEXT: },
+// MYENUM-NEXT: {
+// MYENUM-NEXT: "kind": "identifier",
+// MYENUM-NEXT: "spelling": "MyEnum"
+// MYENUM-NEXT: },
+// MYENUM-NEXT: {
+// MYENUM-NEXT: "kind": "text",
+// MYENUM-NEXT: "spelling": ";"
+// MYENUM-NEXT: }
+// MYENUM-NEXT:],
+// MYENUM: "kind": {
+// MYENUM-NEXT: "displayName": "Enumeration",
+// MYENUM-NEXT: "identifier": "c.enum"
+// MYENUM: "title": "MyEnum"
+
+// CASE-LABEL: "!testLabel": "c:@EA@MyEnum@Case"
+// CASE: "pathComponents": [
+// CASE-NEXT: "MyEnum",
+// CASE-NEXT: "Case"
+// CASE-NEXT: ]
+
+// RUN: FileCheck %s --input-file %t/typedefchain.symbols.json --check-prefix MYENUMENUM
typedef MyEnum MyEnumEnum;
-typedef MyEnumEnum MyEnumEnumEnum;
-// expected-no-diagnostics
+// MYENUMENUM-LABEL: "!testLabel": "c:typedef_anonymous_record.c@T@MyEnumEnum"
+// MYENUMENUM: "declarationFragments": [
+// MYENUMENUM-NEXT: {
+// MYENUMENUM-NEXT: "kind": "keyword",
+// MYENUMENUM-NEXT: "spelling": "typedef"
+// MYENUMENUM-NEXT: },
+// MYENUMENUM-NEXT: {
+// MYENUMENUM-NEXT: "kind": "text",
+// MYENUMENUM-NEXT: "spelling": " "
+// MYENUMENUM-NEXT: },
+// MYENUMENUM-NEXT: {
+// MYENUMENUM-NEXT: "kind": "typeIdentifier",
+// MYENUMENUM-NEXT: "preciseIdentifier": "c:@EA@MyEnum",
+// MYENUMENUM-NEXT: "spelling": "MyEnum"
+// MYENUMENUM-NEXT: },
+// MYENUMENUM-NEXT: {
+// MYENUMENUM-NEXT: "kind": "text",
+// MYENUMENUM-NEXT: "spelling": " "
+// MYENUMENUM-NEXT: },
+// MYENUMENUM-NEXT: {
+// MYENUMENUM-NEXT: "kind": "identifier",
+// MYENUMENUM-NEXT: "spelling": "MyEnumEnum"
+// MYENUMENUM-NEXT: },
+// MYENUMENUM-NEXT: {
+// MYENUMENUM-NEXT: "kind": "text",
+// MYENUMENUM-NEXT: "spelling": ";"
+// MYENUMENUM-NEXT: }
+// MYENUMENUM-NEXT: ],
+// MYENUMENUM: "kind": {
+// MYENUMENUM-NEXT: "displayName": "Type Alias",
+// MYENUMENUM-NEXT: "identifier": "c.typealias"
+// MYENUMENUM-NEXT: },
+// MYENUMENUM: "title": "MyEnumEnum"
-//--- reference.output.json.in
-{
- "metadata": {
- "formatVersion": {
- "major": 0,
- "minor": 5,
- "patch": 3
- },
- "generator": "?"
- },
- "module": {
- "name": "TypedefChain",
- "platform": {
- "architecture": "arm64",
- "operatingSystem": {
- "minimumVersion": {
- "major": 11,
- "minor": 0,
- "patch": 0
- },
- "name": "macosx"
- },
- "vendor": "apple"
- }
- },
- "relationships": [
- {
- "kind": "memberOf",
- "source": "c:@EA@MyEnum@Case",
- "target": "c:@EA@MyEnum",
- "targetFallback": "MyEnum"
- }
- ],
- "symbols": [
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "typedef"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "keyword",
- "spelling": "enum"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "MyEnum"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "identifier": {
- "interfaceLanguage": "c",
- "precise": "c:@EA@MyEnum"
- },
- "kind": {
- "displayName": "Enumeration",
- "identifier": "c.enum"
- },
- "location": {
- "position": {
- "character": 8,
- "line": 3
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "MyEnum"
- }
- ],
- "title": "MyEnum"
- },
- "pathComponents": [
- "MyEnum"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "identifier",
- "spelling": "Case"
- }
- ],
- "identifier": {
- "interfaceLanguage": "c",
- "precise": "c:@EA@MyEnum@Case"
- },
- "kind": {
- "displayName": "Enumeration Case",
- "identifier": "c.enum.case"
- },
- "location": {
- "position": {
- "character": 15,
- "line": 3
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "Case"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "Case"
- }
- ],
- "title": "Case"
- },
- "pathComponents": [
- "MyEnum",
- "Case"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "typedef"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "keyword",
- "spelling": "struct"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "MyStruct"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "identifier": {
- "interfaceLanguage": "c",
- "precise": "c:@SA@MyStruct"
- },
- "kind": {
- "displayName": "Structure",
- "identifier": "c.struct"
- },
- "location": {
- "position": {
- "character": 8,
- "line": 0
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "MyStruct"
- }
- ],
- "title": "MyStruct"
- },
- "pathComponents": [
- "MyStruct"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "typedef"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:@SA@MyStruct",
- "spelling": "MyStruct"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "MyStructStruct"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "identifier": {
- "interfaceLanguage": "c",
- "precise": "c:input.h@T@MyStructStruct"
- },
- "kind": {
- "displayName": "Type Alias",
- "identifier": "c.typealias"
- },
- "location": {
- "position": {
- "character": 17,
- "line": 1
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "MyStructStruct"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "MyStructStruct"
- }
- ],
- "title": "MyStructStruct"
- },
- "pathComponents": [
- "MyStructStruct"
- ],
- "type": "c:@SA@MyStruct"
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "typedef"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:input.h@T@MyStructStruct",
- "spelling": "MyStructStruct"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "MyStructStructStruct"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "identifier": {
- "interfaceLanguage": "c",
- "precise": "c:input.h@T@MyStructStructStruct"
- },
- "kind": {
- "displayName": "Type Alias",
- "identifier": "c.typealias"
- },
- "location": {
- "position": {
- "character": 23,
- "line": 2
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "MyStructStructStruct"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "MyStructStructStruct"
- }
- ],
- "title": "MyStructStructStruct"
- },
- "pathComponents": [
- "MyStructStructStruct"
- ],
- "type": "c:input.h@T@MyStructStruct"
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "typedef"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:@EA@MyEnum",
- "spelling": "MyEnum"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "MyEnumEnum"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "identifier": {
- "interfaceLanguage": "c",
- "precise": "c:input.h@T@MyEnumEnum"
- },
- "kind": {
- "displayName": "Type Alias",
- "identifier": "c.typealias"
- },
- "location": {
- "position": {
- "character": 15,
- "line": 4
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "MyEnumEnum"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "MyEnumEnum"
- }
- ],
- "title": "MyEnumEnum"
- },
- "pathComponents": [
- "MyEnumEnum"
- ],
- "type": "c:@EA@MyEnum"
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "typedef"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:input.h@T@MyEnumEnum",
- "spelling": "MyEnumEnum"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "MyEnumEnumEnum"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "identifier": {
- "interfaceLanguage": "c",
- "precise": "c:input.h@T@MyEnumEnumEnum"
- },
- "kind": {
- "displayName": "Type Alias",
- "identifier": "c.typealias"
- },
- "location": {
- "position": {
- "character": 19,
- "line": 5
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "MyEnumEnumEnum"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "MyEnumEnumEnum"
- }
- ],
- "title": "MyEnumEnumEnum"
- },
- "pathComponents": [
- "MyEnumEnumEnum"
- ],
- "type": "c:input.h@T@MyEnumEnum"
- }
- ]
-}
+// expected-no-diagnostics
diff --git a/clang/test/ExtractAPI/typedef_chain.c b/clang/test/ExtractAPI/typedef_chain.c
index 9e6151c..05d4eb5 100644
--- a/clang/test/ExtractAPI/typedef_chain.c
+++ b/clang/test/ExtractAPI/typedef_chain.c
@@ -2,7 +2,7 @@
// RUN: split-file %s %t
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang -extract-api --product-name=TypedefChain -target arm64-apple-macosx \
+// RUN: %clang -extract-api --pretty-sgf --product-name=TypedefChain -target arm64-apple-macosx \
// RUN: -x objective-c-header %t/input.h -o %t/output.json | FileCheck -allow-empty %s
// Generator version is not consistent across test runs, normalize it.
diff --git a/clang/test/ExtractAPI/typedef_struct_enum.c b/clang/test/ExtractAPI/typedef_struct_enum.c
index 15357d5..fb6fbe9 100644
--- a/clang/test/ExtractAPI/typedef_struct_enum.c
+++ b/clang/test/ExtractAPI/typedef_struct_enum.c
@@ -1,445 +1,146 @@
// RUN: rm -rf %t
-// RUN: split-file %s %t
-// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
-// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang -extract-api -target arm64-apple-macosx \
-// RUN: %t/input.h -o %t/output.json | FileCheck -allow-empty %s
+// RUN: %clang_cc1 -extract-api --pretty-sgf --emit-sgf-symbol-labels-for-testing \
+// RUN: -x c-header %s -triple arm64-apple-macos -o %t/output.symbols.json -verify
-// Generator version is not consistent across test runs, normalize it.
-// RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \
-// RUN: %t/output.json >> %t/output-normalized.json
-// RUN: diff %t/reference.output.json %t/output-normalized.json
-
-// CHECK-NOT: error:
-// CHECK-NOT: warning:
-
-//--- input.h
+// RUN: FileCheck %s --input-file %t/output.symbols.json --check-prefix TEST
typedef struct Test {
} Test;
+// TEST-LABEL: "!testLabel": "c:@S@Test"
+// TEST: "declarationFragments": [
+// TEST-NEXT: {
+// TEST-NEXT: "kind": "keyword",
+// TEST-NEXT: "spelling": "typedef"
+// TEST-NEXT: },
+// TEST-NEXT: {
+// TEST-NEXT: "kind": "text",
+// TEST-NEXT: "spelling": " "
+// TEST-NEXT: },
+// TEST-NEXT: {
+// TEST-NEXT: "kind": "keyword",
+// TEST-NEXT: "spelling": "struct"
+// TEST-NEXT: },
+// TEST-NEXT: {
+// TEST-NEXT: "kind": "text",
+// TEST-NEXT: "spelling": " "
+// TEST-NEXT: },
+// TEST-NEXT: {
+// TEST-NEXT: "kind": "identifier",
+// TEST-NEXT: "spelling": "Test"
+// TEST-NEXT: },
+// TEST-NEXT: {
+// TEST-NEXT: "kind": "text",
+// TEST-NEXT: "spelling": " { ... } "
+// TEST-NEXT: },
+// TEST-NEXT: {
+// TEST-NEXT: "kind": "identifier",
+// TEST-NEXT: "spelling": "Test"
+// TEST-NEXT: },
+// TEST-NEXT: {
+// TEST-NEXT: "kind": "text",
+// TEST-NEXT: "spelling": ";"
+// TEST-NEXT: }
+// TEST-NEXT: ],
+// TEST: "displayName": "Structure",
+// TEST: "title": "Test"
+// RUN: FileCheck %s --input-file %t/output.symbols.json --check-prefix TEST2
typedef enum Test2 {
simple
} Test2;
+// TEST2-LABEL: "!testLabel": "c:@E@Test2"
+// TEST2: "declarationFragments": [
+// TEST2-NEXT: {
+// TEST2-NEXT: "kind": "keyword",
+// TEST2-NEXT: "spelling": "typedef"
+// TEST2-NEXT: },
+// TEST2-NEXT: {
+// TEST2-NEXT: "kind": "text",
+// TEST2-NEXT: "spelling": " "
+// TEST2-NEXT: },
+// TEST2-NEXT: {
+// TEST2-NEXT: "kind": "keyword",
+// TEST2-NEXT: "spelling": "enum"
+// TEST2-NEXT: },
+// TEST2-NEXT: {
+// TEST2-NEXT: "kind": "text",
+// TEST2-NEXT: "spelling": " "
+// TEST2-NEXT: },
+// TEST2-NEXT: {
+// TEST2-NEXT: "kind": "identifier",
+// TEST2-NEXT: "spelling": "Test2"
+// TEST2-NEXT: },
+// TEST2-NEXT: {
+// TEST2-NEXT: "kind": "text",
+// TEST2-NEXT: "spelling": ": "
+// TEST2-NEXT: },
+// TEST2-NEXT: {
+// TEST2-NEXT: "kind": "typeIdentifier",
+// TEST2-NEXT: "preciseIdentifier": "c:i",
+// TEST2-NEXT: "spelling": "unsigned int"
+// TEST2-NEXT: },
+// TEST2-NEXT: {
+// TEST2-NEXT: "kind": "text",
+// TEST2-NEXT: "spelling": " { ... } "
+// TEST2-NEXT: },
+// TEST2-NEXT: {
+// TEST2-NEXT: "kind": "identifier",
+// TEST2-NEXT: "spelling": "Test2"
+// TEST2-NEXT: },
+// TEST2-NEXT: {
+// TEST2-NEXT: "kind": "text",
+// TEST2-NEXT: "spelling": ";"
+// TEST2-NEXT: }
+// TEST2-NEXT: ],
+// TEST2: "displayName": "Enumeration",
+// TEST2: "title": "Test2"
+
struct Foo;
+
+// RUN: FileCheck %s --input-file %t/output.symbols.json --check-prefix TYPEDEF
typedef struct Foo TypedefedFoo;
+// TYPEDEF-LABEL: "!testLabel": "c:typedef_struct_enum.c@T@TypedefedFoo"
+// TYPEDEF: "declarationFragments": [
+// TYPEDEF-NEXT: {
+// TYPEDEF-NEXT: "kind": "keyword",
+// TYPEDEF-NEXT: "spelling": "typedef"
+// TYPEDEF-NEXT: },
+// TYPEDEF-NEXT: {
+// TYPEDEF-NEXT: "kind": "text",
+// TYPEDEF-NEXT: "spelling": " "
+// TYPEDEF-NEXT: },
+// TYPEDEF-NEXT: {
+// TYPEDEF-NEXT: "kind": "keyword",
+// TYPEDEF-NEXT: "spelling": "struct"
+// TYPEDEF-NEXT: },
+// TYPEDEF-NEXT: {
+// TYPEDEF-NEXT: "kind": "text",
+// TYPEDEF-NEXT: "spelling": " "
+// TYPEDEF-NEXT: },
+// TYPEDEF-NEXT: {
+// TYPEDEF-NEXT: "kind": "typeIdentifier",
+// TYPEDEF-NEXT: "preciseIdentifier": "c:@S@Foo",
+// TYPEDEF-NEXT: "spelling": "Foo"
+// TYPEDEF-NEXT: },
+// TYPEDEF-NEXT: {
+// TYPEDEF-NEXT: "kind": "text",
+// TYPEDEF-NEXT: "spelling": " "
+// TYPEDEF-NEXT: },
+// TYPEDEF-NEXT: {
+// TYPEDEF-NEXT: "kind": "identifier",
+// TYPEDEF-NEXT: "spelling": "TypedefedFoo"
+// TYPEDEF-NEXT: },
+// TYPEDEF-NEXT: {
+// TYPEDEF-NEXT: "kind": "text",
+// TYPEDEF-NEXT: "spelling": ";"
+// TYPEDEF-NEXT: }
+// TYPEDEF-NEXT: ],
+// TYPEDEF: "displayName": "Type Alias",
+// TYPEDEF: "title": "TypedefedFoo"
+// TYPEDEF: "type": "c:@S@Foo"
+
struct Foo {
int bar;
};
-//--- reference.output.json.in
-{
- "metadata": {
- "formatVersion": {
- "major": 0,
- "minor": 5,
- "patch": 3
- },
- "generator": "?"
- },
- "module": {
- "name": "",
- "platform": {
- "architecture": "arm64",
- "operatingSystem": {
- "minimumVersion": {
- "major": 11,
- "minor": 0,
- "patch": 0
- },
- "name": "macosx"
- },
- "vendor": "apple"
- }
- },
- "relationships": [
- {
- "kind": "memberOf",
- "source": "c:@E@Test2@simple",
- "target": "c:@E@Test2",
- "targetFallback": "Test2"
- },
- {
- "kind": "memberOf",
- "source": "c:@S@Foo@FI@bar",
- "target": "c:@S@Foo",
- "targetFallback": "Foo"
- }
- ],
- "symbols": [
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "typedef"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "keyword",
- "spelling": "enum"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "Test2"
- },
- {
- "kind": "text",
- "spelling": ": "
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:i",
- "spelling": "unsigned int"
- },
- {
- "kind": "text",
- "spelling": " { ... } "
- },
- {
- "kind": "identifier",
- "spelling": "Test2"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "identifier": {
- "interfaceLanguage": "c",
- "precise": "c:@E@Test2"
- },
- "kind": {
- "displayName": "Enumeration",
- "identifier": "c.enum"
- },
- "location": {
- "position": {
- "character": 13,
- "line": 3
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "Test2"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "Test2"
- }
- ],
- "title": "Test2"
- },
- "pathComponents": [
- "Test2"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "identifier",
- "spelling": "simple"
- }
- ],
- "identifier": {
- "interfaceLanguage": "c",
- "precise": "c:@E@Test2@simple"
- },
- "kind": {
- "displayName": "Enumeration Case",
- "identifier": "c.enum.case"
- },
- "location": {
- "position": {
- "character": 2,
- "line": 4
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "simple"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "simple"
- }
- ],
- "title": "simple"
- },
- "pathComponents": [
- "Test2",
- "simple"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "typedef"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "keyword",
- "spelling": "struct"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "Test"
- },
- {
- "kind": "text",
- "spelling": " { ... } "
- },
- {
- "kind": "identifier",
- "spelling": "Test"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "identifier": {
- "interfaceLanguage": "c",
- "precise": "c:@S@Test"
- },
- "kind": {
- "displayName": "Structure",
- "identifier": "c.struct"
- },
- "location": {
- "position": {
- "character": 15,
- "line": 0
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "Test"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "Test"
- }
- ],
- "title": "Test"
- },
- "pathComponents": [
- "Test"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "struct"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "Foo"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "identifier": {
- "interfaceLanguage": "c",
- "precise": "c:@S@Foo"
- },
- "kind": {
- "displayName": "Structure",
- "identifier": "c.struct"
- },
- "location": {
- "position": {
- "character": 7,
- "line": 9
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "Foo"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "Foo"
- }
- ],
- "title": "Foo"
- },
- "pathComponents": [
- "Foo"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "bar"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "identifier": {
- "interfaceLanguage": "c",
- "precise": "c:@S@Foo@FI@bar"
- },
- "kind": {
- "displayName": "Instance Property",
- "identifier": "c.property"
- },
- "location": {
- "position": {
- "character": 8,
- "line": 10
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "bar"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "bar"
- }
- ],
- "title": "bar"
- },
- "pathComponents": [
- "Foo",
- "bar"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "typedef"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "keyword",
- "spelling": "struct"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:@S@Foo",
- "spelling": "Foo"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "TypedefedFoo"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "identifier": {
- "interfaceLanguage": "c",
- "precise": "c:input.h@T@TypedefedFoo"
- },
- "kind": {
- "displayName": "Type Alias",
- "identifier": "c.typealias"
- },
- "location": {
- "position": {
- "character": 19,
- "line": 8
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "TypedefedFoo"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "TypedefedFoo"
- }
- ],
- "title": "TypedefedFoo"
- },
- "pathComponents": [
- "TypedefedFoo"
- ],
- "type": "c:@S@Foo"
- }
- ]
-}
+// expected-no-diagnostics
diff --git a/clang/test/ExtractAPI/underscored.c b/clang/test/ExtractAPI/underscored.c
index 30d2b63..204ec36 100644
--- a/clang/test/ExtractAPI/underscored.c
+++ b/clang/test/ExtractAPI/underscored.c
@@ -1,17 +1,5 @@
-// RUN: rm -rf %t
-// RUN: split-file %s %t
-// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
-// RUN: %t/reference.output.json.in >> %t/reference.output.json
// RUN: %clang_cc1 -extract-api -triple arm64-apple-macosx \
-// RUN: -x c-header %t/input.h -o %t/output.json -verify
-
-// Generator version is not consistent across test runs, normalize it.
-// RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \
-// RUN: %t/output.json >> %t/output-normalized.json
-// RUN: diff %t/reference.output.json %t/output-normalized.json
-
-//--- input.h
-// expected-no-diagnostics
+// RUN: -x c-header %s -o - -verify | FileCheck %s
// Global record
int _HiddenGlobal;
@@ -19,399 +7,22 @@ int exposed_global;
// Record type
struct _HiddenRecord {
- int a;
+ int HiddenRecordMember;
};
struct ExposedRecord {
- int a;
+ int ExposedRecordMember;
};
-// Typedef
-typedef struct {} _HiddenTypedef;
-typedef int ExposedTypedef;
-typedef _HiddenTypedef ExposedTypedefToHidden;
-
// Macros
#define _HIDDEN_MACRO 5
#define EXPOSED_MACRO 5
-// Symbols that start with '_' should not appear in the reference output
-//--- reference.output.json.in
-{
- "metadata": {
- "formatVersion": {
- "major": 0,
- "minor": 5,
- "patch": 3
- },
- "generator": "?"
- },
- "module": {
- "name": "",
- "platform": {
- "architecture": "arm64",
- "operatingSystem": {
- "minimumVersion": {
- "major": 11,
- "minor": 0,
- "patch": 0
- },
- "name": "macosx"
- },
- "vendor": "apple"
- }
- },
- "relationships": [
- {
- "kind": "memberOf",
- "source": "c:@S@ExposedRecord@FI@a",
- "target": "c:@S@ExposedRecord",
- "targetFallback": "ExposedRecord"
- }
- ],
- "symbols": [
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "exposed_global"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "identifier": {
- "interfaceLanguage": "c",
- "precise": "c:@exposed_global"
- },
- "kind": {
- "displayName": "Global Variable",
- "identifier": "c.var"
- },
- "location": {
- "position": {
- "character": 4,
- "line": 4
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "exposed_global"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "exposed_global"
- }
- ],
- "title": "exposed_global"
- },
- "pathComponents": [
- "exposed_global"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "struct"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "ExposedRecord"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "identifier": {
- "interfaceLanguage": "c",
- "precise": "c:@S@ExposedRecord"
- },
- "kind": {
- "displayName": "Structure",
- "identifier": "c.struct"
- },
- "location": {
- "position": {
- "character": 7,
- "line": 11
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "ExposedRecord"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "ExposedRecord"
- }
- ],
- "title": "ExposedRecord"
- },
- "pathComponents": [
- "ExposedRecord"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "a"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "identifier": {
- "interfaceLanguage": "c",
- "precise": "c:@S@ExposedRecord@FI@a"
- },
- "kind": {
- "displayName": "Instance Property",
- "identifier": "c.property"
- },
- "location": {
- "position": {
- "character": 6,
- "line": 12
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "a"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "a"
- }
- ],
- "title": "a"
- },
- "pathComponents": [
- "ExposedRecord",
- "a"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "#define"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "EXPOSED_MACRO"
- }
- ],
- "identifier": {
- "interfaceLanguage": "c",
- "precise": "c:input.h@335@macro@EXPOSED_MACRO"
- },
- "kind": {
- "displayName": "Macro",
- "identifier": "c.macro"
- },
- "location": {
- "position": {
- "character": 8,
- "line": 22
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "EXPOSED_MACRO"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "EXPOSED_MACRO"
- }
- ],
- "title": "EXPOSED_MACRO"
- },
- "pathComponents": [
- "EXPOSED_MACRO"
- ]
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "typedef"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:I",
- "spelling": "int"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "ExposedTypedef"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "identifier": {
- "interfaceLanguage": "c",
- "precise": "c:input.h@T@ExposedTypedef"
- },
- "kind": {
- "displayName": "Type Alias",
- "identifier": "c.typealias"
- },
- "location": {
- "position": {
- "character": 12,
- "line": 17
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "ExposedTypedef"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "ExposedTypedef"
- }
- ],
- "title": "ExposedTypedef"
- },
- "pathComponents": [
- "ExposedTypedef"
- ],
- "type": "c:I"
- },
- {
- "accessLevel": "public",
- "declarationFragments": [
- {
- "kind": "keyword",
- "spelling": "typedef"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "typeIdentifier",
- "preciseIdentifier": "c:@SA@_HiddenTypedef",
- "spelling": "_HiddenTypedef"
- },
- {
- "kind": "text",
- "spelling": " "
- },
- {
- "kind": "identifier",
- "spelling": "ExposedTypedefToHidden"
- },
- {
- "kind": "text",
- "spelling": ";"
- }
- ],
- "identifier": {
- "interfaceLanguage": "c",
- "precise": "c:input.h@T@ExposedTypedefToHidden"
- },
- "kind": {
- "displayName": "Type Alias",
- "identifier": "c.typealias"
- },
- "location": {
- "position": {
- "character": 23,
- "line": 18
- },
- "uri": "file://INPUT_DIR/input.h"
- },
- "names": {
- "navigator": [
- {
- "kind": "identifier",
- "spelling": "ExposedTypedefToHidden"
- }
- ],
- "subHeading": [
- {
- "kind": "identifier",
- "spelling": "ExposedTypedefToHidden"
- }
- ],
- "title": "ExposedTypedefToHidden"
- },
- "pathComponents": [
- "ExposedTypedefToHidden"
- ],
- "type": "c:@SA@_HiddenTypedef"
- }
- ]
-}
+// expected-no-diagnostics
+
+// CHECK-NOT: _HiddenRecord
+// CHECK-NOT: HiddenRecordMember
+// CHECK: ExposedRecord
+// CHECK: ExposedRecordMember
+// CHECK-NOT: _HIDDEN_MACRO
+// CHECK: EXPOSED_MACRO
diff --git a/clang/test/ExtractAPI/union.c b/clang/test/ExtractAPI/union.c
index 6ec9fd3..8f8300b 100644
--- a/clang/test/ExtractAPI/union.c
+++ b/clang/test/ExtractAPI/union.c
@@ -2,7 +2,7 @@
// RUN: split-file %s %t
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/reference.output.json.in >> %t/reference.output.json
-// RUN: %clang_cc1 -extract-api -triple arm64-apple-macosx -x c-header\
+// RUN: %clang_cc1 -extract-api --pretty-sgf -triple arm64-apple-macosx -x c-header\
// RUN: %t/input.h -o %t/output.json -verify
// Generator version is not consistent across test runs, normalize it.
@@ -12,7 +12,7 @@
//--- input.h
/// My Union
-union Union{
+union Union {
/// the a option
int a;
/// the b option
diff --git a/clang/test/ExtractAPI/vfs_redirected_include.m b/clang/test/ExtractAPI/vfs_redirected_include.m
index 9ba7e1d..db03820 100644
--- a/clang/test/ExtractAPI/vfs_redirected_include.m
+++ b/clang/test/ExtractAPI/vfs_redirected_include.m
@@ -14,7 +14,7 @@
// RUN: %t/vfsoverlay.yaml.in >> %t/vfsoverlay.yaml
// Input headers use paths to the framework root/DSTROOT
-// RUN: %clang_cc1 -extract-api -v --product-name=MyFramework \
+// RUN: %clang_cc1 -extract-api --pretty-sgf -v --product-name=MyFramework \
// RUN: -triple arm64-apple-macosx \
// RUN: -iquote%t -ivfsoverlay %t/vfsoverlay.yaml -F%t/Frameworks \
// RUN: -x objective-c-header \