Skip to content

Commit

Permalink
[clang][ExtractAPI] Emit environment component of target triple in SGF (
Browse files Browse the repository at this point in the history
#103273)

rdar://133533830
  • Loading branch information
daniel-grumberg authored Aug 15, 2024
1 parent 11c2da8 commit 57abd4e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
4 changes: 4 additions & 0 deletions clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ Object serializePlatform(const Triple &T) {
Object Platform;
Platform["architecture"] = T.getArchName();
Platform["vendor"] = T.getVendorName();

if (!T.getEnvironmentName().empty())
Platform["environment"] = T.getEnvironmentName();

Platform["operatingSystem"] = serializeOperatingSystem(T);
return Platform;
}
Expand Down
20 changes: 20 additions & 0 deletions clang/test/ExtractAPI/platform-serialization.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// RUN: %clang_cc1 -extract-api --pretty-sgf -triple arm64-apple-ios17.1-macabi \
// RUN: -x c-header %s -verify -o - | FileCheck %s

int a;

// CHECK: "platform": {
// CHECK-NEXT: "architecture": "arm64",
// CHECK-NEXT: "environment": "macabi",
// CHECK-NEXT: "operatingSystem": {
// CHECK-NEXT: "minimumVersion": {
// CHECK-NEXT: "major": 14,
// CHECK-NEXT: "minor": 0,
// CHECK-NEXT: "patch": 0
// CHECK-NEXT: },
// CHECK-NEXT: "name": "ios"
// CHECK-NEXT: },
// CHECK-NEXT: "vendor": "apple"
// CHECK-NEXT: }

// expected-no-diagnostics

0 comments on commit 57abd4e

Please sign in to comment.