1 // RUN: rm -rf %t 2 // RUN: split-file %s %t 3 // RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \ 4 // RUN: %t/reference.output.json.in >> %t/reference.output.json 5 // RUN: %clang -extract-api --product-name=GlobalRecord -target arm64-apple-macosx \ 6 // RUN: %t/input1.h -o %t/output.json | FileCheck -allow-empty %s 7 8 // Generator version is not consistent across test runs, normalize it. 9 // RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \ 10 // RUN: %t/output.json >> %t/output-normalized.json 11 // RUN: diff %t/reference.output.json %t/output-normalized.json 12 13 // CHECK-NOT: error: 14 // CHECK-NOT: warning: 15 16 //--- input1.h 17 int num; 18 #include "input2.h" 19 20 //--- input2.h 21 // Ensure that these symbols are not emitted in the Symbol Graph. 22 #define HELLO 1 23 char not_emitted; 24 void foo(int); 25 struct Foo { int a; }; 26 27 //--- reference.output.json.in 28 { 29 "metadata": { 30 "formatVersion": { 31 "major": 0, 32 "minor": 5, 33 "patch": 3 34 }, 35 "generator": "?" 36 }, 37 "module": { 38 "name": "GlobalRecord", 39 "platform": { 40 "architecture": "arm64", 41 "operatingSystem": { 42 "minimumVersion": { 43 "major": 11, 44 "minor": 0, 45 "patch": 0 46 }, 47 "name": "macosx" 48 }, 49 "vendor": "apple" 50 } 51 }, 52 "relationships": [], 53 "symbols": [ 54 { 55 "accessLevel": "public", 56 "declarationFragments": [ 57 { 58 "kind": "typeIdentifier", 59 "preciseIdentifier": "c:I", 60 "spelling": "int" 61 }, 62 { 63 "kind": "text", 64 "spelling": " " 65 }, 66 { 67 "kind": "identifier", 68 "spelling": "num" 69 } 70 ], 71 "identifier": { 72 "interfaceLanguage": "c", 73 "precise": "c:@num" 74 }, 75 "kind": { 76 "displayName": "Global Variable", 77 "identifier": "c.var" 78 }, 79 "location": { 80 "position": { 81 "character": 5, 82 "line": 1 83 }, 84 "uri": "file://INPUT_DIR/input1.h" 85 }, 86 "names": { 87 "navigator": [ 88 { 89 "kind": "identifier", 90 "spelling": "num" 91 } 92 ], 93 "subHeading": [ 94 { 95 "kind": "identifier", 96 "spelling": "num" 97 } 98 ], 99 "title": "num" 100 }, 101 "pathComponents": [ 102 "num" 103 ] 104 } 105 ] 106 } 107