CXPlatformAvailability *availability,
int availability_size) {
bool HadAvailAttr = false;
+ bool DidSetDeprecatedMessage = false;
+ bool DidSetUnavailableMessage = false;
+
int N = 0;
for (auto A : D->attrs()) {
if (DeprecatedAttr *Deprecated = dyn_cast<DeprecatedAttr>(A)) {
HadAvailAttr = true;
if (always_deprecated)
*always_deprecated = 1;
- if (deprecated_message)
+ if (deprecated_message) {
+ if (DidSetDeprecatedMessage)
+ clang_disposeString(*deprecated_message);
*deprecated_message = cxstring::createDup(Deprecated->getMessage());
+ DidSetDeprecatedMessage = true;
+ }
continue;
}
if (always_unavailable)
*always_unavailable = 1;
if (unavailable_message) {
+ if (DidSetUnavailableMessage)
+ clang_disposeString(*unavailable_message);
*unavailable_message = cxstring::createDup(Unavailable->getMessage());
+ DidSetUnavailableMessage = true;
}
continue;
}