[PATCH] D30762: [ubsan] Add a nullability sanitizer

2017-03-13 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL297700: [ubsan] Add a nullability sanitizer (authored by vedantk). Changed prior to commit: https://reviews.llvm.org/D30762?vs=91382=91658#toc Repository: rL LLVM https://reviews.llvm.org/D30762

[PATCH] D30762: [ubsan] Add a nullability sanitizer

2017-03-10 Thread Vedant Kumar via Phabricator via cfe-commits
vsk updated this revision to Diff 91382. vsk marked 4 inline comments as done. vsk added a comment. - Rework documentation, add better code comments, and tighten up some check lines. https://reviews.llvm.org/D30762 Files: docs/UndefinedBehaviorSanitizer.rst

[PATCH] D30762: [ubsan] Add a nullability sanitizer

2017-03-10 Thread Vedant Kumar via Phabricator via cfe-commits
vsk marked 9 inline comments as done. vsk added a comment. The plan is to start off with -fsanitize=nullability, and then create a nullability-pedantic group later if it's really necessary. I think I've addressed all of the inline comments, and will upload a new diff shortly.

[PATCH] D30762: [ubsan] Add a nullability sanitizer

2017-03-09 Thread Anna Zaks via Phabricator via cfe-commits
zaks.anna added inline comments. Comment at: docs/UndefinedBehaviorSanitizer.rst:101 + ``-fsanitize=nullability-assign``, and the argument check with + ``-fsanitize=nullability-arg``. While violating nullability rules does + not result in undefined behavior, it is

[PATCH] D30762: [ubsan] Add a nullability sanitizer

2017-03-09 Thread Vedant Kumar via Phabricator via cfe-commits
vsk added a comment. One question for Anna (inline). I will update the diff with the documentation/code comments/renaming fixes once I hear back. Thanks again for the comments! Comment at: docs/UndefinedBehaviorSanitizer.rst:101 + ``-fsanitize=nullability-assign``, and

[PATCH] D30762: [ubsan] Add a nullability sanitizer

2017-03-09 Thread Filipe Cabecinhas via Phabricator via cfe-commits
filcab added a comment. Please make the tests tighter using `CHECK-NEXT` when possible. Much easier if later anyone needs to debug differences in IR. Comment at: docs/UndefinedBehaviorSanitizer.rst:102 + violating nullability rules does not result in undefined behavior,

[PATCH] D30762: [ubsan] Add a nullability sanitizer

2017-03-09 Thread Anna Zaks via Phabricator via cfe-commits
zaks.anna added inline comments. Comment at: docs/UndefinedBehaviorSanitizer.rst:101 + ``-fsanitize=nullability-assign``, and the argument check with + ``-fsanitize=nullability-arg``. While violating nullability rules does + not result in undefined behavior, it is

[PATCH] D30762: [ubsan] Add a nullability sanitizer

2017-03-09 Thread Vedant Kumar via Phabricator via cfe-commits
vsk updated this revision to Diff 91180. vsk added a comment. - Add a test for the mixed _Nonnull arg + __attribute__((nonnull)) arg case. - Reword docs per Adrian's comments, fix up doxygen comments, add better code comments, drop redundant "Nullability" truthiness checks.

[PATCH] D30762: [ubsan] Add a nullability sanitizer

2017-03-09 Thread Vedant Kumar via Phabricator via cfe-commits
vsk marked 8 inline comments as done. vsk added a comment. Thanks for your comments, and sorry for jumping the gun earlier with an updated diff. I'll attach a fixed-up diff shortly. Comment at: lib/CodeGen/CGDecl.cpp:1911 +if (auto Nullability =

[PATCH] D30762: [ubsan] Add a nullability sanitizer

2017-03-09 Thread Jonathan Roelofs via Phabricator via cfe-commits
jroelofs added inline comments. Comment at: lib/CodeGen/CGDecl.cpp:1911 +if (auto Nullability = Ty->getNullability(getContext())) { + if (Nullability && *Nullability == NullabilityKind::NonNull) { +SanitizerScope SanScope(this); aprantl wrote: >

[PATCH] D30762: [ubsan] Add a nullability sanitizer

2017-03-08 Thread Vedant Kumar via Phabricator via cfe-commits
vsk updated this revision to Diff 91100. vsk added reviewers: aprantl, arphaman. vsk added a comment. - Improve the wording of the docs. - Drop a weak test from 'ubsan-null-retval.m'. https://reviews.llvm.org/D30762 Files: docs/UndefinedBehaviorSanitizer.rst

[PATCH] D30762: [ubsan] Add a nullability sanitizer

2017-03-08 Thread Adrian Prantl via Phabricator via cfe-commits
aprantl added inline comments. Comment at: docs/UndefinedBehaviorSanitizer.rst:98 + pointer as a function parameter which is annotated with ``_Nonnull``, + or assigning null to a lvalue marked ``_Nonnull``. You can enable + just the return value check with

[PATCH] D30762: [ubsan] Add a nullability sanitizer

2017-03-08 Thread Vedant Kumar via Phabricator via cfe-commits
vsk created this revision. Teach UBSan how to detect violations of the _Nonnull annotation when passing arguments to callees, in assignments, and in return stmts. Because _Nonnull does not affect IRGen, the new checks are disabled by default. The new driver flags are: