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

Nico Weber thakis at chromium.org
Thu Apr 24 09:50:00 PDT 2014


Thanks!


On Wed, Apr 23, 2014 at 11:05 PM, Argyrios Kyrtzidis <akyrtzi at gmail.com>wrote:

> 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;
>      }
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140424/656437ae/attachment.html>


More information about the cfe-commits mailing list