llvm-project/clang/lib
Vedant Kumar c34d343f15 [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
2017-06-23 21:32:38 +00:00
..
ARCMigrate Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC. 2017-06-03 06:23:19 +00:00
AST [MS] Don't statically initialize dllimport member function pointers 2017-06-23 18:29:13 +00:00
ASTMatchers [ASTMatchers] Fix use after free. 2017-06-09 17:55:42 +00:00
Analysis Changed wording in comment 2017-06-21 05:41:39 +00:00
Basic [MSP430] Fix data layout string. 2017-06-23 21:12:56 +00:00
CodeGen [ubsan] Improve diagnostics for return value checks (clang) 2017-06-23 21:32:38 +00:00
Driver Sort the autocomplete candidates before printing them out. 2017-06-23 15:37:52 +00:00
Edit [clang] Fix format specifiers fixits for nested macros 2017-06-20 20:46:58 +00:00
Format [clang-format] Add a SortUsingDeclaration option and enable it by default 2017-06-23 11:46:03 +00:00
Frontend Revert "Revert r305164/5/7." 2017-06-23 15:34:16 +00:00
FrontendTool Add -frewrite-imports flag. 2017-06-09 21:24:02 +00:00
Headers [DOXYGEN] Corrected several typos and incorrect parameters description that Sony's techinical writer found during review. 2017-06-06 22:58:01 +00:00
Index [index] Add the "SpecializationOf" relation to the forward declarations 2017-06-22 11:20:07 +00:00
Lex [preprocessor] Fix assertion hit when 'SingleFileParseMode' option is enabled and #if with an undefined identifier and without #else 2017-06-21 18:52:44 +00:00
Parse [Parser][ObjC] Use an artificial EOF token while parsing lexed ObjC methods 2017-06-19 17:53:21 +00:00
Rewrite Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC. 2017-06-03 06:29:40 +00:00
Sema Emit warning when throw exception in destruct or dealloc functions which has a 2017-06-23 20:22:19 +00:00
Serialization PR33552: Distinguish between declarations that are owned by no module and 2017-06-23 01:04:34 +00:00
StaticAnalyzer [analyzer] Do not continue to analyze a path if the constraints contradict with builtin assume 2017-06-22 10:09:40 +00:00
Tooling Method loadFromCommandLine should be able to report errors 2017-05-24 11:57:37 +00:00
CMakeLists.txt