Debian Codegraph @

clang/test/ExtractAPI/objc_external_category.m

raw
1 // RUN: rm -rf %t
2 // RUN: split-file %s %t
3 // RUN: %clang_cc1 -extract-api --pretty-sgf --emit-sgf-symbol-labels-for-testing \
4 // RUN: --emit-extension-symbol-graphs --symbol-graph-dir=%t/symbols \
5 // RUN: --product-name=Module -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/modules-cache \
6 // RUN: -triple arm64-apple-macosx -x objective-c-header %t/input.h -verify
7 // RUN: %clang_cc1 -extract-api --pretty-sgf --emit-sgf-symbol-labels-for-testing \
8 // RUN: --product-name=Module -o %t/ModuleNoExt.symbols.json -triple arm64-apple-macosx \
9 // RUN: -x objective-c-header %t/input.h
10
11 //--- input.h
12 #include "ExternalModule.h"
13
14 @interface ExtInterface (Category)
15 @property int Property;
16 - (void)InstanceMethod;
17 + (void)ClassMethod;
18 @end
19
20 @interface ModInterface
21 @end
22
23 // expected-no-diagnostics
24
25 //--- ExternalModule.h
26 @interface ExtInterface
27 @end
28
29 //--- module.modulemap
30 module ExternalModule {
31 header "ExternalModule.h"
32 }
33
34 // Main symbol graph from the build with extension SGFs
35 // RUN: FileCheck %s --input-file %t/symbols/Module.symbols.json --check-prefix MOD
36
37 // MOD-NOT: "!testRelLabel": "memberOf $ c:objc(cs)ExtInterface(py)Property $ c:objc(cs)ExtInterface"
38 // MOD-NOT: "!testRelLabel": "memberOf $ c:objc(cs)ExtInterface(im)InstanceMethod $ c:objc(cs)ExtInterface"
39 // MOD-NOT: "!testRelLabel": "memberOf $ c:objc(cs)ExtInterface(cm)ClassMethod $ c:objc(cs)ExtInterface"
40 // MOD-NOT: "c:objc(cs)ExtInterface(py)Property"
41 // MOD-NOT: "c:objc(cs)ExtInterface(im)InstanceMethod"
42 // MOD-NOT: "c:objc(cs)ExtInterface(cm)ClassMethod"
43 // MOD-NOT: "c:objc(cs)ExtInterface"
44 // MOD-DAG: "c:objc(cs)ModInterface"
45
46 // Symbol graph from the build without extension SGFs should be identical to main symbol graph with extension SGFs
47 // RUN: diff %t/symbols/Module.symbols.json %t/ModuleNoExt.symbols.json
48
49 // RUN: FileCheck %s --input-file %t/symbols/[email protected] --check-prefix EXT
50 // EXT-DAG: "!testRelLabel": "memberOf $ c:objc(cs)ExtInterface(py)Property $ c:objc(cs)ExtInterface"
51 // EXT-DAG: "!testRelLabel": "memberOf $ c:objc(cs)ExtInterface(im)InstanceMethod $ c:objc(cs)ExtInterface"
52 // EXT-DAG: "!testRelLabel": "memberOf $ c:objc(cs)ExtInterface(cm)ClassMethod $ c:objc(cs)ExtInterface"
53 // EXT-DAG: "!testLabel": "c:objc(cs)ExtInterface(py)Property"
54 // EXT-DAG: "!testLabel": "c:objc(cs)ExtInterface(im)InstanceMethod"
55 // EXT-DAG: "!testLabel": "c:objc(cs)ExtInterface(cm)ClassMethod"
56 // EXT-NOT: "!testLabel": "c:objc(cs)ExtInterface"
57 // EXT-NOT: "!testLabel": "c:objc(cs)ModInterface"
58
59 // Ensure that the 'module' metadata for the extension symbol graph should still reference the
60 // declaring module
61
62 // RUN: FileCheck %s --input-file %t/symbols/[email protected] --check-prefix META
63 // META: "module": {
64 // META-NEXT: "name": "Module",