[PATCH] D37042: Teach clang to tolerate the 'p = nullptr + n' idiom used by glibc

Andy Kaylor via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 30 14:25:11 PDT 2017


andrew.w.kaylor updated this revision to Diff 113311.
andrew.w.kaylor added a comment.

Refactored the GNU idiom check to be shared  by Sema and CodeGen.
Refined the checks so that nullptr+0 doesn't warn in C++.
Added the zero offset qualification in the warning produced with C++.


https://reviews.llvm.org/D37042

Files:
  include/clang/AST/Expr.h
  include/clang/Basic/DiagnosticGroups.td
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/AST/Expr.cpp
  lib/CodeGen/CGExprScalar.cpp
  lib/Sema/SemaExpr.cpp
  test/CodeGen/nullptr-arithmetic.c
  test/Sema/pointer-addition.c
  test/SemaCXX/nullptr-arithmetic.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37042.113311.patch
Type: text/x-patch
Size: 12772 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170830/27feac02/attachment.bin>


More information about the cfe-commits mailing list