Simplify leak fix of r207076, by just disposing the previous CXString.

llvm-svn: 207081
This commit is contained in:
Argyrios Kyrtzidis 2014-04-24 06:05:40 +00:00
parent 00dcc0f53c
commit edfe07fca0
1 changed files with 2 additions and 9 deletions

View File

@ -6027,9 +6027,6 @@ static int getCursorPlatformAvailabilityForDecl(const Decl *D,
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)) {
@ -6037,10 +6034,8 @@ static int getCursorPlatformAvailabilityForDecl(const Decl *D,
if (always_deprecated)
*always_deprecated = 1;
if (deprecated_message) {
if (DidSetDeprecatedMessage)
clang_disposeString(*deprecated_message);
clang_disposeString(*deprecated_message);
*deprecated_message = cxstring::createDup(Deprecated->getMessage());
DidSetDeprecatedMessage = true;
}
continue;
}
@ -6050,10 +6045,8 @@ static int getCursorPlatformAvailabilityForDecl(const Decl *D,
if (always_unavailable)
*always_unavailable = 1;
if (unavailable_message) {
if (DidSetUnavailableMessage)
clang_disposeString(*unavailable_message);
clang_disposeString(*unavailable_message);
*unavailable_message = cxstring::createDup(Unavailable->getMessage());
DidSetUnavailableMessage = true;
}
continue;
}