summaryrefslogtreecommitdiffstats
path: root/clang/tools/libclang/CIndex.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2014-04-24 06:05:40 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2014-04-24 06:05:40 +0000
commitedfe07fca0ae8c4ef749d9fac859b17f7dd23f65 (patch)
tree3d40e51c69b7f0c605077b684c821f5136d537ef /clang/tools/libclang/CIndex.cpp
parent00dcc0f53c36fec51579ced2b933cf3fff6955c5 (diff)
downloadbcm5719-llvm-edfe07fca0ae8c4ef749d9fac859b17f7dd23f65.tar.gz
bcm5719-llvm-edfe07fca0ae8c4ef749d9fac859b17f7dd23f65.zip
Simplify leak fix of r207076, by just disposing the previous CXString.
llvm-svn: 207081
Diffstat (limited to 'clang/tools/libclang/CIndex.cpp')
-rw-r--r--clang/tools/libclang/CIndex.cpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index 25f53c4f3d6..f3c9f2fa444 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/tools/libclang/CIndex.cpp
@@ -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;
}
OpenPOWER on IntegriCloud