-
Notifications
You must be signed in to change notification settings - Fork 10.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[clang][ExtractAPI] Allow serialization for ObjC++ headers #74733
Merged
daniel-grumberg
merged 1 commit into
llvm:main
from
daniel-grumberg:objcpp-serialization
Dec 7, 2023
Merged
[clang][ExtractAPI] Allow serialization for ObjC++ headers #74733
daniel-grumberg
merged 1 commit into
llvm:main
from
daniel-grumberg:objcpp-serialization
Dec 7, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rdar://79874441
@llvm/pr-subscribers-clang Author: Daniel Grumberg (daniel-grumberg) Changesrdar://79874441 Full diff: https://github.com/llvm/llvm-project/pull/74733.diff 2 Files Affected:
diff --git a/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp b/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
index 931933b2bd1ac0..d9675b0c94de39 100644
--- a/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
+++ b/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
@@ -199,9 +199,10 @@ StringRef getLanguageName(Language Lang) {
return "objective-c";
case Language::CXX:
return "c++";
+ case Language::ObjCXX:
+ return "objective-c++";
// Unsupported language currently
- case Language::ObjCXX:
case Language::OpenCL:
case Language::OpenCLCXX:
case Language::CUDA:
diff --git a/clang/test/ExtractAPI/language.c b/clang/test/ExtractAPI/language.c
index 6facd18f5d9810..fe98626c84613e 100644
--- a/clang/test/ExtractAPI/language.c
+++ b/clang/test/ExtractAPI/language.c
@@ -4,29 +4,42 @@
// RUN: %t/c.reference.output.json.in >> %t/c.reference.output.json
// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
// RUN: %t/objc.reference.output.json.in >> %t/objc.reference.output.json
+// RUN: sed -e "s@INPUT_DIR@%{/t:regex_replacement}@g" \
+// RUN: %t/objcpp.reference.output.json.in >> %t/objcpp.reference.output.json
-// RUN: %clang -extract-api -x c-header -target arm64-apple-macosx \
+// RUN: %clang_cc1 -extract-api -x c-header -triple arm64-apple-macosx \
// RUN: %t/c.h -o %t/c.output.json | FileCheck -allow-empty %s
-// RUN: %clang -extract-api -x objective-c-header -target arm64-apple-macosx \
+// RUN: %clang_cc1 -extract-api -x objective-c-header -triple arm64-apple-macosx \
// RUN: %t/objc.h -o %t/objc.output.json | FileCheck -allow-empty %s
+// RUN: %clang_cc1 -extract-api -x objective-c++-header -triple arm64-apple-macosx \
+// RUN: %t/objcpp.h -o %t/objcpp.output.json | FileCheck -allow-empty %s
// Generator version is not consistent across test runs, normalize it.
// RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \
// RUN: %t/c.output.json >> %t/c.output-normalized.json
// RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \
// RUN: %t/objc.output.json >> %t/objc.output-normalized.json
+// RUN: sed -e "s@\"generator\": \".*\"@\"generator\": \"?\"@g" \
+// RUN: %t/objcpp.output.json >> %t/objcpp.output-normalized.json
// RUN: diff %t/c.reference.output.json %t/c.output-normalized.json
// RUN: diff %t/objc.reference.output.json %t/objc.output-normalized.json
+// RUN: diff %t/objcpp.reference.output.json %t/objcpp.output-normalized.json
// CHECK-NOT: error:
// CHECK-NOT: warning:
//--- c.h
char c;
+///expected-no-diagnostics
//--- objc.h
char objc;
+///expected-no-diagnostics
+
+//--- objcpp.h
+char objcpp;
+///expected-no-diagnostics
//--- c.reference.output.json.in
{
@@ -196,3 +209,87 @@ char objc;
}
]
}
+//--- objcpp.reference.output.json.in
+{
+ "metadata": {
+ "formatVersion": {
+ "major": 0,
+ "minor": 5,
+ "patch": 3
+ },
+ "generator": "?"
+ },
+ "module": {
+ "name": "",
+ "platform": {
+ "architecture": "arm64",
+ "operatingSystem": {
+ "minimumVersion": {
+ "major": 11,
+ "minor": 0,
+ "patch": 0
+ },
+ "name": "macosx"
+ },
+ "vendor": "apple"
+ }
+ },
+ "relationships": [],
+ "symbols": [
+ {
+ "accessLevel": "public",
+ "declarationFragments": [
+ {
+ "kind": "typeIdentifier",
+ "preciseIdentifier": "c:C",
+ "spelling": "char"
+ },
+ {
+ "kind": "text",
+ "spelling": " "
+ },
+ {
+ "kind": "identifier",
+ "spelling": "objcpp"
+ },
+ {
+ "kind": "text",
+ "spelling": ";"
+ }
+ ],
+ "identifier": {
+ "interfaceLanguage": "objective-c++",
+ "precise": "c:@objcpp"
+ },
+ "kind": {
+ "displayName": "Global Variable",
+ "identifier": "objective-c++.var"
+ },
+ "location": {
+ "position": {
+ "character": 5,
+ "line": 0
+ },
+ "uri": "file://INPUT_DIR/objcpp.h"
+ },
+ "names": {
+ "navigator": [
+ {
+ "kind": "identifier",
+ "spelling": "objcpp"
+ }
+ ],
+ "subHeading": [
+ {
+ "kind": "identifier",
+ "spelling": "objcpp"
+ }
+ ],
+ "title": "objcpp"
+ },
+ "pathComponents": [
+ "objcpp"
+ ]
+ }
+ ]
+}
|
QuietMisdreavus
approved these changes
Dec 7, 2023
daniel-grumberg
added a commit
to daniel-grumberg/llvm-project
that referenced
this pull request
Dec 7, 2023
daniel-grumberg
added a commit
to apple/llvm-project
that referenced
this pull request
Dec 8, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
rdar://79874441