[clang] [clang][ExtractAPI] emit correct spelling for type aliases (PR #134007)
Yanzuo Liu via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 1 17:55:34 PDT 2025
================
@@ -0,0 +1,56 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -extract-api --pretty-sgf --emit-sgf-symbol-labels-for-testing \
+// RUN: --product-name=TypeAlias -triple arm64-apple-macosx -x c++-header %s -o %t/type-alias.symbols.json -verify
+
+// RUN: FileCheck %s --input-file %t/type-alias.symbols.json --check-prefix MYALIAS
+using MyAlias = int;
+//MYALIAS-LABEL "!testLabel": "c:@MYALIAS"
+//MYALIAS: "accessLevel": "public",
+//MYALIAS: "declarationFragments": [
+//MYALIAS-NEXT: {
+//MYALIAS-NEXT: "kind": "keyword",
+//MYALIAS-NEXT: "spelling": "using"
+//MYALIAS-NEXT: },
+//MYALIAS-NEXT: {
+//MYALIAS-NEXT: "kind": "text",
+//MYALIAS-NEXT: "spelling": " "
+//MYALIAS-NEXT: },
+//MYALIAS-NEXT: {
+//MYALIAS-NEXT: "kind": "identifier",
+//MYALIAS-NEXT: "spelling": "MyAlias"
+//MYALIAS-NEXT: },
+//MYALIAS-NEXT: {
+//MYALIAS-NEXT: "kind": "text",
+//MYALIAS-NEXT: "spelling": " = "
+//MYALIAS-NEXT: },
+//MYALIAS-NEXT: {
+//MYALIAS-NEXT: "kind": "typeIdentifier",
+//MYALIAS-NEXT: "preciseIdentifier": "c:I",
+//MYALIAS-NEXT: "spelling": "int"
+//MYALIAS-NEXT: },
+//MYALIAS-NEXT: {
+//MYALIAS-NEXT: "kind": "text",
+//MYALIAS-NEXT: "spelling": ";"
+//MYALIAS-NEXT: }
+//MYALIAS: "kind": {
+//MYALIAS-NEXT: "displayName": "Type Alias",
+//MYALIAS-NEXT: "identifier": "c++.typealias"
+//MYALIAS: names": {
+//MYALIAS-NEXT: "navigator": [
+//MYALIAS-NEXT: {
+//MYALIAS-NEXT: "kind": "identifier",
+//MYALIAS-NEXT: "spelling": "MyAlias"
+//MYALIAS-NEXT: }
+//MYALIAS-NEXT: ],
+//MYALIAS-NEXT: "subHeading": [
+//MYALIAS-NEXT: {
+//MYALIAS-NEXT: "kind": "identifier",
+//MYALIAS-NEXT: "spelling": "MyAlias"
+//MYALIAS-NEXT: }
+//MYALIAS-NEXT: ],
+//MYALIAS-NEXT: "title": "MyAlias"
+//MYALIAS: "pathComponents": [
+//MYALIAS-NEXT: "MyAlias"
+//MYALIAS-NEXT: ]
+
+// expected-no-diagnostics
----------------
zwuis wrote:
nit: add a new line charactor at end of file
https://github.com/llvm/llvm-project/pull/134007
More information about the cfe-commits
mailing list