Re: [PATCH] D19851: Warn on binding reference to null in copy initialization

2016-05-14 Thread Nick Lewycky via cfe-commits
nicholas closed this revision. nicholas added a comment. Closed by r269572. http://reviews.llvm.org/D19851 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Re: [PATCH] D19851: Warn on binding reference to null in copy initialization

2016-05-13 Thread Richard Smith via cfe-commits
rsmith accepted this revision. Comment at: include/clang/Basic/DiagnosticSemaKinds.td:5369 @@ -5368,1 +5368,3 @@ +def warn_binding_null_to_reference : Warning< + "binding null pointer to reference has undefined behavior">, InGroup; def note_indirection_through_null : Note<

Re: [PATCH] D19851: Warn on binding reference to null in copy initialization

2016-05-08 Thread Nick Lewycky via cfe-commits
nicholas updated this revision to Diff 56526. nicholas added a comment. Unsure why, but the previous diff didn't have the 'volatile' check removed. http://reviews.llvm.org/D19851 Files: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaInit.cpp test/CXX/expr/expr.prim/expr.prim.lamb

Re: [PATCH] D19851: Warn on binding reference to null in copy initialization

2016-05-04 Thread Nick Lewycky via cfe-commits
nicholas updated this revision to Diff 56236. nicholas added a comment. (Whoops, forgot to generate diff with full context for phab.) http://reviews.llvm.org/D19851 Files: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaInit.cpp test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp te

Re: [PATCH] D19851: Warn on binding reference to null in copy initialization

2016-05-04 Thread Nick Lewycky via cfe-commits
nicholas updated this revision to Diff 56235. nicholas marked an inline comment as done. http://reviews.llvm.org/D19851 Files: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaInit.cpp test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp test/Parser/cxx-casting.cpp test/SemaCXX/cstyle

Re: [PATCH] D19851: Warn on binding reference to null in copy initialization

2016-05-04 Thread Nick Lewycky via cfe-commits
nicholas marked 2 inline comments as done. Comment at: lib/Sema/SemaInit.cpp:3514-3518 @@ +3513,7 @@ +static void CheckForNullPointerDereference(Sema &S, const Expr *E) { + // Check to see if we are dereferencing a null pointer. If so, + // and if not volatile-qualified, this i

Re: [PATCH] D19851: Warn on binding reference to null in copy initialization

2016-05-04 Thread Richard Smith via cfe-commits
rsmith added a comment. In http://reviews.llvm.org/D19851#420762, @nicholas wrote: > I did not expand this to SK_BindReferenceToTemporary, please review this > decision. It's also missing missing bit-field and vector element checks that > SK_BindReference has. That's fine. SK_BindReferenceToT

Re: [PATCH] D19851: Warn on binding reference to null in copy initialization

2016-05-04 Thread Aaron Ballman via cfe-commits
aaron.ballman accepted this revision. aaron.ballman added a comment. This revision is now accepted and ready to land. This generally LGTM, but you should wait for @rsmith to sign off before committing. Comment at: test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp:39 @@ -38,3 +38,

Re: [PATCH] D19851: Warn on binding reference to null in copy initialization

2016-05-04 Thread Nick Lewycky via cfe-commits
nicholas updated this revision to Diff 56100. http://reviews.llvm.org/D19851 Files: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaInit.cpp test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp test/Parser/cxx-casting.cpp test/SemaCXX/cstyle-cast.cpp test/SemaCXX/functional-cast.cp

Re: [PATCH] D19851: Warn on binding reference to null in copy initialization

2016-05-04 Thread Nick Lewycky via cfe-commits
nicholas marked 2 inline comments as done. nicholas added a comment. Richard Smith gave me some review feedback in person, the diagnostic should not be generated when setting up the Steps for the initializer sequence, but instead when InitializerSequence::Perform is called. This appears to work

Re: [PATCH] D19851: Warn on binding reference to null in copy initialization

2016-05-03 Thread Aaron Ballman via cfe-commits
aaron.ballman added a subscriber: aaron.ballman. Comment at: lib/Sema/SemaInit.cpp:3513 @@ -3512,1 +3512,3 @@ +static void CheckForNullPointerDereference(Sema &S, Expr *E) { + // Check to see if we are dereferencing a null pointer. If so, Can this take a `cons

[PATCH] D19851: Warn on binding reference to null in copy initialization

2016-05-02 Thread Nick Lewycky via cfe-commits
nicholas created this revision. nicholas added a reviewer: cfe-commits. The attached patch adds a warning when placing a call like: func(*static_cast(nullptr)); to the existing -Wnull-dereference warning. The existing warning catches the case where the empty lvalue undergoes lvalue-to-rvalue c