[clang-tools-extra] r245471 - [clang-tidy] Fix a bug in UseNullptrCheck.

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 19 17:00:36 PDT 2015


After looking at the code once again, I found an obvious use-after-free bug
which could have caused all of this (and for some reason only manifested
itself on Darwin). r245524 should fix the issue.

On Thu, Aug 20, 2015 at 1:44 AM, Justin Bogner <mail at justinbogner.com>
wrote:

> That didn't work either - both tests are still failing.
>
> Alexander Kornienko <alexfh at google.com> writes:
> > Something weird happens with options reading. Submitted a possible
> workaround
> > in r245517.
> >
> > On Thu, Aug 20, 2015 at 12:48 AM, Justin Bogner <mail at justinbogner.com>
> wrote:
> >
> >     Locally, it seems to fail two tests now:
> >
> >     Failing Tests (2):
> >         Clang Tools :: clang-tidy/modernize-use-nullptr-basic.cpp
> >         Clang Tools :: clang-tidy/modernize-use-nullptr.cpp
> >
> >     I'll poke at it for a minute and see if there's something obvious I
> can
> >     do, but running the run line manually just seems to return 127 with
> no
> >     output for me (as opposed to the output that's printed correctly
> under
> >     lit)
> >
> >     Alexander Kornienko via cfe-commits <cfe-commits at lists.llvm.org>
> writes:
> >     > I've committed the check with minor modifications and without the
> >     offending
> >     > test in r245511. Could you verify that it works in your setup?
> >     >
> >     > -- Alex
> >     >
> >     > On Wed, Aug 19, 2015 at 11:41 PM, Pete Cooper <
> peter_cooper at apple.com>
> >     wrote:
> >     >
> >     >         On Aug 19, 2015, at 2:38 PM, Alexander Kornienko <
> >     alexfh at google.com>
> >     >         wrote:
> >     >
> >     >         The check has been reverted in r245493. Sorry for the
> breakage,
> >     I was
> >     >         hoping that this commit fixes it.
> >     >
> >     >     No problem.  Thanks for taking a look.
> >     >
> >     >     If you think the rest of the code is good and want to land it
> again
> >     then
> >     >     thats fine.  You can leave out the check below until you are
> happy
> >     that
> >     >     its working too.  That way you potentially won’t be blocked
> for too
> >     long.
> >     >
> >     >     Thanks,
> >     >     Pete
> >     >
> >     >         On Wed, Aug 19, 2015 at 10:31 PM, Pete Cooper <
> >     peter_cooper at apple.com>
> >     >         wrote:
> >     >
> >     >             Looks like its only a single test thats failing.
> >     >
> >     >             Would you mind if I remove this piece of the test
> until we
> >     can get
> >     >             to the bottom of it?
> >     >
> >     >                 void test_macro_expansion4() {
> >     >                 #define MY_NULL NULL
> >     >                   int *p = MY_NULL;
> >     >                   // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: use
> >     nullptr
> >     >                 [modernize-use-nullptr]
> >     >                   // CHECK-FIXES: int *p = nullptr;
> >     >                 #undef MY_NULL
> >     >                 }
> >     >
> >     >             Thanks,
> >     >             Pete
> >     >
> >     >                 On Aug 19, 2015, at 1:00 PM, Pete Cooper <
> >     >                 peter_cooper at apple.com> wrote:
> >     >
> >     >                 Hi Alexander
> >     >
> >     >                 We’re still getting a green dragon failure on the
> null
> >     ptr
> >     >                 check test.  Mind taking a look?
> >     >
> >     >                 http://lab.llvm.org:8080/green/job/
> >     >                 clang-stage1-configure-RA_check/10351/consoleFull#
> >     >                 50560140149ba4694-19c4-4d7e-bec5-911270d8a58c
> >     >
> >     >                 Thanks
> >     >                 Pete
> >     >
> >     >                     On Aug 19, 2015, at 10:50 AM, Alexander
> Kornienko
> >     via
> >     >                     cfe-commits <cfe-commits at lists.llvm.org>
> wrote:
> >     >
> >     >                     Author: alexfh
> >     >                     Date: Wed Aug 19 12:50:22 2015
> >     >                     New Revision: 245471
> >     >
> >     >                     URL:
> https://urldefense.proofpoint.com/v2/url?u=
> >     >
> >      http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D245471-26view-3Drev
> >     >                     &d=BQIGaQ&c=eEvniauFctOgLOKGJOplqw&r=
> >     >                     03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjM&m=
> >     >                     vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQ&s=
> >     >                     wuoYp-wW8aBSkIHSX7igi7DHfur7JyIHWwnzHMTYdlg&e=
> >     >                     Log:
> >     >                     [clang-tidy] Fix a bug in UseNullptrCheck.
> >     >
> >     >                     https://urldefense.proofpoint.com/v2/url?u=
> >     >                     http-3A__reviews.llvm.org_D12162&d=BQIGaQ&c=
> >     >                     eEvniauFctOgLOKGJOplqw&r=
> >     >                     03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjM&m=
> >     >                     vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQ&s=
> >     >                     YiXUYCqfOl7durvaPOdifn3l7_G0FJhlE4A_q5Q6xwM&e=
> >     >
> >     >                     Patch by Angel Garcia!
> >     >
> >     >                     Modified:
> >     >
>     clang-tools-extra/trunk/clang-tidy/modernize/
> >     >                     UseNullptrCheck.cpp
> >     >
> >     >                     Modified: clang-tools-extra/trunk/clang-tidy/
> >     modernize/
> >     >                     UseNullptrCheck.cpp
> >     >                     URL:
> https://urldefense.proofpoint.com/v2/url?u=
> >     >
> >
>   http-3A__llvm.org_viewvc_llvm-2Dproject_clang-2Dtools-2Dextra_trunk_clang-2Dtidy_modernize_UseNullptrCheck.cpp-3Frev-3D245471-26r1-3D245470-26r2-3D245471-26view-3Ddiff
> >     >                     &d=BQIGaQ&c=eEvniauFctOgLOKGJOplqw&r=
> >     >                     03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjM&m=
> >     >                     vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQ&s=
> >     >                     4y-EkuMJJlcYjI15KrZY8VE3eGEhkvg9ScDcHtItY2g&e=
> >     >
>  ====================================================
> >     ======
> >     >                     ====================
> >     >                     ---
> clang-tools-extra/trunk/clang-tidy/modernize/
> >     >                     UseNullptrCheck.cpp (original)
> >     >                     +++
> clang-tools-extra/trunk/clang-tidy/modernize/
> >     >                     UseNullptrCheck.cpp Wed Aug 19 12:50:22 2015
> >     >                     @@ -175,10 +175,10 @@ private:
> >     >                     class CastSequenceVisitor : public
> >     RecursiveASTVisitor
> >     >                     <CastSequenceVisitor> {
> >     >                     public:
> >     >                       CastSequenceVisitor(ASTContext &Context,
> >     >                     -                      SmallVector<StringRef,
> 1>
> >     >                     UserNullMacros,
> >     >                     +                      ArrayRef<StringRef>
> >     UserNullMacros,
> >     >                                           ClangTidyCheck &check)
> >     >                           : SM(Context.getSourceManager()), Context
> >     (Context),
> >     >                     -
>        UserNullMacros(std::move(UserNullMacros)),
> >     Check
> >     >                     (check),
> >     >                     +        UserNullMacros(UserNullMacros), Check
> >     (check),
> >     >                             FirstSubExpr(nullptr),
> PruneSubtree(false)
> >     {}
> >     >
> >     >                       bool TraverseStmt(Stmt *S) {
> >     >                     @@ -435,7 +435,7 @@ private:
> >     >                     private:
> >     >                       SourceManager &SM;
> >     >                       ASTContext &Context;
> >     >                     -  const SmallVector<StringRef, 1>
> &UserNullMacros;
> >     >                     +  ArrayRef<StringRef> UserNullMacros;
> >     >                       ClangTidyCheck &Check;
> >     >                       Expr *FirstSubExpr;
> >     >                       bool PruneSubtree;
> >     >
> >     >                     _______________________________________________
> >     >                     cfe-commits mailing list
> >     >                     cfe-commits at lists.llvm.org
> >     >                     https://urldefense.proofpoint.com/v2/url?u=
> >     >
> >      http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_cfe-2Dcommits
> >     >                     &d=BQIGaQ&c=eEvniauFctOgLOKGJOplqw&r=
> >     >                     03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjM&m=
> >     >                     vEGzlOUc6IO5ny5JKNkJAUEoiokQ1N60GDcHk0yboKQ&s=
> >     >                     UUHB6kbqbYNAr9eIu4oMQTKtxnQ37-xusL7D-UY0GR4&e=
> >     >
> >     > _______________________________________________
> >     > cfe-commits mailing list
> >     > cfe-commits at lists.llvm.org
> >     > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150820/115f09ad/attachment-0001.html>


More information about the cfe-commits mailing list