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

Argyrios Kyrtzidis akyrtzi at gmail.com
Wed Apr 23 23:05:40 PDT 2014


Author: akirtzidis
Date: Thu Apr 24 01:05:40 2014
New Revision: 207081

URL: http://llvm.org/viewvc/llvm-project?rev=207081&view=rev
Log:
Simplify leak fix of r207076, by just disposing the previous CXString.

Modified:
    cfe/trunk/tools/libclang/CIndex.cpp

Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=207081&r1=207080&r2=207081&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Thu Apr 24 01:05:40 2014
@@ -6027,9 +6027,6 @@ static int getCursorPlatformAvailability
                                            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 getCursorPlatformAvailability
       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 getCursorPlatformAvailability
       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;
     }





More information about the cfe-commits mailing list