summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/android/AndroidTidyModule.cpp
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2017-06-23 21:32:38 +0000
committerVedant Kumar <vsk@apple.com>2017-06-23 21:32:38 +0000
commitc34d343f15373dde087897d33fe3173726dd4cf1 (patch)
tree36ede4fd471c6f0cc0e76502eb6671951292d07f /clang-tools-extra/clang-tidy/android/AndroidTidyModule.cpp
parent77a2e6b198550e2e4bccf8b724bc1b7f8fa819ec (diff)
downloadbcm5719-llvm-c34d343f15373dde087897d33fe3173726dd4cf1.tar.gz
bcm5719-llvm-c34d343f15373dde087897d33fe3173726dd4cf1.zip
[ubsan] Improve diagnostics for return value checks (clang)
This patch makes ubsan's nonnull return value diagnostics more precise, which makes the diagnostics more useful when there are multiple return statements in a function. Example: 1 |__attribute__((returns_nonnull)) char *foo() { 2 | if (...) { 3 | return expr_which_might_evaluate_to_null(); 4 | } else { 5 | return another_expr_which_might_evaluate_to_null(); 6 | } 7 |} // <- The current diagnostic always points here! runtime error: Null returned from Line 7, Column 2! With this patch, the diagnostic would point to either Line 3, Column 5 or Line 5, Column 5. This is done by emitting source location metadata for each return statement in a sanitized function. The runtime is passed a pointer to the appropriate metadata so that it can prepare and deduplicate reports. Compiler-rt patch (with more tests): https://reviews.llvm.org/D34298 Differential Revision: https://reviews.llvm.org/D34299 llvm-svn: 306163
Diffstat (limited to 'clang-tools-extra/clang-tidy/android/AndroidTidyModule.cpp')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud