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=Typedef -target arm64-apple-macosx \ 6 // RUN: -x objective-c-header %t/input.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 //--- input.h 17 typedef int MyInt; 18 19 //--- reference.output.json.in 20 { 21 "metadata": { 22 "formatVersion": { 23 "major": 0, 24 "minor": 5, 25 "patch": 3 26 }, 27 "generator": "?" 28 }, 29 "module": { 30 "name": "Typedef", 31 "platform": { 32 "architecture": "arm64", 33 "operatingSystem": { 34 "minimumVersion": { 35 "major": 11, 36 "minor": 0, 37 "patch": 0 38 }, 39 "name": "macosx" 40 }, 41 "vendor": "apple" 42 } 43 }, 44 "relationships": [], 45 "symbols": [ 46 { 47 "accessLevel": "public", 48 "declarationFragments": [ 49 { 50 "kind": "keyword", 51 "spelling": "typedef" 52 }, 53 { 54 "kind": "text", 55 "spelling": " " 56 }, 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": "MyInt" 69 } 70 ], 71 "identifier": { 72 "interfaceLanguage": "objective-c", 73 "precise": "c:input.h@T@MyInt" 74 }, 75 "kind": { 76 "displayName": "Type Alias", 77 "identifier": "objective-c.typealias" 78 }, 79 "location": { 80 "position": { 81 "character": 13, 82 "line": 1 83 }, 84 "uri": "file://INPUT_DIR/input.h" 85 }, 86 "names": { 87 "navigator": [ 88 { 89 "kind": "identifier", 90 "spelling": "MyInt" 91 } 92 ], 93 "subHeading": [ 94 { 95 "kind": "identifier", 96 "spelling": "MyInt" 97 } 98 ], 99 "title": "MyInt" 100 }, 101 "pathComponents": [ 102 "MyInt" 103 ], 104 "type": "c:I" 105 } 106 ] 107 } 108