[PATCH] D144940: [clang][ExtractAPI] Handle platform specific unavailability correctly
Daniel Grumberg via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 2 07:50:55 PST 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG65f7a84cf38b: [clang][ExtractAPI] Handle platform specific unavailability correctly (authored by Arsenic, committed by dang).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144940/new/
https://reviews.llvm.org/D144940
Files:
clang/include/clang/ExtractAPI/AvailabilityInfo.h
clang/lib/ExtractAPI/AvailabilityInfo.cpp
clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
clang/test/ExtractAPI/availability.c
Index: clang/test/ExtractAPI/availability.c
===================================================================
--- clang/test/ExtractAPI/availability.c
+++ clang/test/ExtractAPI/availability.c
@@ -26,6 +26,9 @@
void f(void) __attribute__((unavailable)) __attribute__((availability(macos, introduced=11.0)));
void d(void) __attribute__((availability(tvos, introduced=15.0)));
+
+void e(void) __attribute__((availability(tvos, unavailable)));
+
///expected-no-diagnostics
//--- reference.output.json.in
@@ -391,6 +394,10 @@
"minor": 0,
"patch": 0
}
+ },
+ {
+ "domain": "tvos",
+ "isUnconditionallyUnavailable": true
}
],
"declarationFragments": [
Index: clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
===================================================================
--- clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
+++ clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
@@ -171,12 +171,16 @@
for (const auto &AvailInfo : Availabilities) {
Object Availability;
Availability["domain"] = AvailInfo.Domain;
- serializeObject(Availability, "introducedVersion",
- serializeSemanticVersion(AvailInfo.Introduced));
- serializeObject(Availability, "deprecatedVersion",
- serializeSemanticVersion(AvailInfo.Deprecated));
- serializeObject(Availability, "obsoletedVersion",
- serializeSemanticVersion(AvailInfo.Obsoleted));
+ if (AvailInfo.Unavailable)
+ Availability["isUnconditionallyUnavailable"] = true;
+ else {
+ serializeObject(Availability, "introducedVersion",
+ serializeSemanticVersion(AvailInfo.Introduced));
+ serializeObject(Availability, "deprecatedVersion",
+ serializeSemanticVersion(AvailInfo.Deprecated));
+ serializeObject(Availability, "obsoletedVersion",
+ serializeSemanticVersion(AvailInfo.Obsoleted));
+ }
AvailabilityArray.emplace_back(std::move(Availability));
}
Index: clang/lib/ExtractAPI/AvailabilityInfo.cpp
===================================================================
--- clang/lib/ExtractAPI/AvailabilityInfo.cpp
+++ clang/lib/ExtractAPI/AvailabilityInfo.cpp
@@ -42,8 +42,8 @@
Availability->Obsoleted = Attr->getObsoleted();
} else {
Availabilities.emplace_back(Domain, Attr->getIntroduced(),
- Attr->getDeprecated(),
- Attr->getObsoleted());
+ Attr->getDeprecated(), Attr->getObsoleted(),
+ Attr->getUnavailable());
}
}
}
Index: clang/include/clang/ExtractAPI/AvailabilityInfo.h
===================================================================
--- clang/include/clang/ExtractAPI/AvailabilityInfo.h
+++ clang/include/clang/ExtractAPI/AvailabilityInfo.h
@@ -33,12 +33,14 @@
VersionTuple Introduced;
VersionTuple Deprecated;
VersionTuple Obsoleted;
+ bool Unavailable;
AvailabilityInfo() = default;
AvailabilityInfo(StringRef Domain, VersionTuple I, VersionTuple D,
- VersionTuple O)
- : Domain(Domain), Introduced(I), Deprecated(D), Obsoleted(O) {}
+ VersionTuple O, bool U)
+ : Domain(Domain), Introduced(I), Deprecated(D), Obsoleted(O),
+ Unavailable(U) {}
};
class AvailabilitySet {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144940.501872.patch
Type: text/x-patch
Size: 3500 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230302/bda1d1da/attachment-0001.bin>
More information about the cfe-commits
mailing list