[clang-tools-extra] r213845 - [clang-tidy] Fix a heap use-after-free bug detected by asan.
Richard Smith
richard at metafoo.co.uk
Thu Jul 24 12:09:55 PDT 2014
On 24 Jul 2014 01:46, "Benjamin Kramer" <benny.kra at googlemail.com> wrote:
>
> Author: d0k
> Date: Thu Jul 24 03:34:42 2014
> New Revision: 213845
>
> URL: http://llvm.org/viewvc/llvm-project?rev=213845&view=rev
> Log:
> [clang-tidy] Fix a heap use-after-free bug detected by asan.
>
> Modified:
> clang-tools-extra/trunk/clang-tidy/misc/UnusedRAII.cpp
>
> Modified: clang-tools-extra/trunk/clang-tidy/misc/UnusedRAII.cpp
> URL:
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/UnusedRAII.cpp?rev=213845&r1=213844&r2=213845&view=diff
>
==============================================================================
> --- clang-tools-extra/trunk/clang-tidy/misc/UnusedRAII.cpp (original)
> +++ clang-tools-extra/trunk/clang-tidy/misc/UnusedRAII.cpp Thu Jul 24
03:34:42 2014
> @@ -17,7 +17,7 @@ namespace clang {
> namespace ast_matchers {
> AST_MATCHER(CXXRecordDecl, hasUserDeclaredDestructor) {
> // TODO: If the dtor is there but empty we don't want to warn either.
> - return Node.hasUserDeclaredDestructor();
> + return Node.hasDefinition() && Node.hasUserDeclaredDestructor();
Did you mean to include this change?
> }
> } // namespace ast_matchers
>
> @@ -73,9 +73,9 @@ void UnusedRAIICheck::check(const MatchF
> // Otherwise just suggest adding a name. To find the place to insert
the name
> // find the first TypeLoc in the children of E, which always points to
the
> // written type.
> - const auto *TL =
> - selectFirst<TypeLoc>("t",
match(expr(hasDescendant(typeLoc().bind("t"))),
> - *E, *Result.Context));
> + auto Matches =
> + match(expr(hasDescendant(typeLoc().bind("t"))), *E,
*Result.Context);
> + const auto *TL = selectFirst<TypeLoc>("t", Matches);
> D << FixItHint::CreateInsertion(
> Lexer::getLocForEndOfToken(TL->getLocEnd(), 0,
*Result.SourceManager,
> Result.Context->getLangOpts()),
>
>
> _______________________________________________
> 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/20140724/36a96191/attachment.html>
More information about the cfe-commits
mailing list