llvm-project/clang/docs
Vedant Kumar 42c17ec5ac [ubsan] Add a nullability sanitizer
Teach UBSan to detect when a value with the _Nonnull type annotation
assumes a null value. Call expressions, initializers, assignments, and
return statements are all checked.

Because _Nonnull does not affect IRGen, the new checks are disabled by
default. The new driver flags are:

  -fsanitize=nullability-arg      (_Nonnull violation in call)
  -fsanitize=nullability-assign   (_Nonnull violation in assignment)
  -fsanitize=nullability-return   (_Nonnull violation in return stmt)
  -fsanitize=nullability          (all of the above)

This patch builds on top of UBSan's existing support for detecting
violations of the nonnull attributes ('nonnull' and 'returns_nonnull'),
and relies on the compiler-rt support for those checks. Eventually we
will need to update the diagnostic messages in compiler-rt (there are
FIXME's for this, which will be addressed in a follow-up).

One point of note is that the nullability-return check is only allowed
to kick in if all arguments to the function satisfy their nullability
preconditions. This makes it necessary to emit some null checks in the
function body itself.

Testing: check-clang and check-ubsan. I also built some Apple ObjC
frameworks with an asserts-enabled compiler, and verified that we get
valid reports.

Differential Revision: https://reviews.llvm.org/D30762

llvm-svn: 297700
2017-03-14 01:56:34 +00:00
..
CommandGuide Driver: Remove support for -fobjc-gc* 2016-12-07 00:31:10 +00:00
analyzer [analyzer] Improve usability of ExprInspectionChecker 2017-03-09 00:01:10 +00:00
tools [clang-format] Add more examples and fix a bug in the py generation script 2017-03-13 14:42:47 +00:00
AddressSanitizer.rst [asan][docs] Fix the documentation to use clang++ for the C++ example 2016-12-15 22:55:21 +00:00
AttributeReference.rst Adding a title to appease the sphinx build bot. 2015-06-23 17:31:30 +00:00
AutomaticReferenceCounting.rst docs: update docs for objc_storeStrong behaviour 2017-02-11 17:24:09 +00:00
Block-ABI-Apple.rst Fix example: byref struct's init was incorrect, and the block literal's holder should point to it. 2016-12-22 23:48:23 +00:00
Block-ABI-Apple.txt
BlockLanguageSpec.rst
CMakeLists.txt Fix build. 2016-04-28 14:28:19 +00:00
ClangCheck.rst [clang docs] Minor fix in ClangCheck.rst 2016-11-14 17:31:24 +00:00
ClangCommandLineReference.rst [X86] Add -mprefetchwt1/-mno-prefetchwt1 command line options and __PREFETCHWT1__ define to match gcc. 2017-02-08 08:23:40 +00:00
ClangFormat.rst Add the --no-color option to the git call in the doc when using clang-format-diff 2016-12-03 23:22:45 +00:00
ClangFormatStyleOptions.rst [clang-format] Add more examples and fix a bug in the py generation script 2017-03-13 14:42:47 +00:00
ClangPlugins.rst Removing more :option: tags that we do not have corresponding .. option directives for; these are causing the sphinx bot to fail (http://lab.llvm.org:8011/builders/clang-sphinx-docs/builds/15195/steps/docs-clang-html/logs/stdio). 2016-07-14 14:07:37 +00:00
ClangTools.rst Fixed a link. 2015-11-04 19:42:17 +00:00
ControlFlowIntegrity.rst Re-apply r267784, r267824 and r267830. 2016-04-28 17:09:37 +00:00
ControlFlowIntegrityDesign.rst fix a few typo in the doc but also in the clang messages 2017-01-14 11:41:45 +00:00
CrossCompilation.rst [docs] Use x86_64 and i386 instead of x86 as arch for triples. 2016-12-05 22:52:20 +00:00
DataFlowSanitizer.rst
DataFlowSanitizerDesign.rst
DiagnosticsReference.rst [docs] Regenerate DiagnosticsReference.rst. We don't have automatic generation of this set up server-side yet. 2017-01-20 19:27:09 +00:00
DriverArchitecture.png
DriverInternals.rst Driver: Replace a couple of out of date terms in the docs 2015-07-03 08:03:43 +00:00
ExternalClangExamples.rst Add clazy to external Clang examples page 2017-02-24 08:29:46 +00:00
FAQ.rst
HowToSetupToolingForLLVM.rst Fixed a typo (compilation_commands.json --> compile_commands.json). 2016-08-19 13:36:31 +00:00
InternalsManual.rst [docs] Change non-c++ code blocks to 'text' format to fix a sphinx warning. 2016-02-24 15:07:48 +00:00
IntroductionToTheClangAST.rst
ItaniumMangleAbiTags.rst NFC fix documentation build by rL263015 2016-03-09 19:39:16 +00:00
JSONCompilationDatabase.rst Extend CompilationDatabase by a field for the output filename 2016-12-01 23:37:45 +00:00
LTOVisibility.rst docs: Clarify that LTO visibility is based on source-level symbol visibility. 2016-05-27 22:31:30 +00:00
LanguageExtensions.rst Fix documentation typo from r292558. 2017-01-23 18:17:46 +00:00
LeakSanitizer.rst [Docs] Slightly update LSan documentation. 2016-01-22 01:35:45 +00:00
LibASTMatchers.rst Typo fix in AST matcher documentation: s/aribtrary/arbitrary/ 2016-12-31 01:04:02 +00:00
LibASTMatchersReference.html Fix documentation typo. 2017-01-20 09:54:26 +00:00
LibASTMatchersTutorial.rst [clang] Minor fix to libASTMatcherTutorial 2016-12-30 20:49:44 +00:00
LibFormat.rst
LibTooling.rst
MSVCCompatibility.rst Update MSVC compat docs about debug info 2016-12-14 21:34:19 +00:00
Makefile.sphinx docs: Clarify that cfi-unrelated-cast is based on lifetime. 2016-02-01 18:55:50 +00:00
MemorySanitizer.rst [docs] Update the TSan and MSan docs to refer to the new no_sanitize attribute 2016-10-27 21:38:44 +00:00
Modules.rst [Modules] Add a command line option for loading the clang builtins modulemap. 2016-10-31 08:21:54 +00:00
ObjectiveCLiterals.rst Fix typo. NFC. 2015-06-27 19:04:55 +00:00
PCHInternals.rst Removing a few more :option: tags that we do not have corresponding .. option directives for; these are causing the sphinx bot to fail (http://lab.llvm.org:8011/builders/clang-sphinx-docs/builds/15197/steps/docs-clang-html/logs/stdio). 2016-07-14 15:32:11 +00:00
PCHLayout.graffle
PCHLayout.png
PTHInternals.rst PTHInternals.rst: PCH is now a thing, update docs to reflect it 2014-07-07 14:02:39 +00:00
RAVFrontendAction.rst docs: Remove references to the long-defunct LLVM_USED_LIBS 2015-11-26 19:52:24 +00:00
README.txt
ReleaseNotes.rst Don't try to link to the 4.0 release notes 2017-02-09 23:26:34 +00:00
SafeStack.rst docs: Document how safestack handles setjmp and exceptions. 2016-05-24 23:38:02 +00:00
SanitizerCoverage.rst [sancov] pc_guard_init is called at least once per DSO. 2017-02-08 21:28:39 +00:00
SanitizerSpecialCaseList.rst
SanitizerStats.rst Introduce -fsanitize-stats flag. 2016-01-16 00:31:22 +00:00
SourceBasedCodeCoverage.rst [docs] coverage: Clarify which flags enable gcov-style profiling (NFC) 2017-02-09 21:33:21 +00:00
ThinLTO.rst [ThinLTO] Update doc to include lld (now supported). 2016-10-13 17:42:38 +00:00
ThreadSafetyAnalysis.rst Updating the documentation to include an operator! for negative capability support. 2015-05-22 13:36:48 +00:00
ThreadSanitizer.rst [docs] Update the TSan and MSan docs to refer to the new no_sanitize attribute 2016-10-27 21:38:44 +00:00
Toolchain.rst Add documentation describing the components of a complete toolchain including Clang. 2016-10-27 20:55:56 +00:00
Tooling.rst
UndefinedBehaviorSanitizer.rst [ubsan] Add a nullability sanitizer 2017-03-14 01:56:34 +00:00
UsersManual.rst Update Bugzilla URLs in docs 2017-02-17 08:26:54 +00:00
conf.py Update docs/conf.py version 2017-01-12 21:41:38 +00:00
doxygen-mainpage.dox [docs] Add missing file 2016-03-03 10:44:10 +00:00
doxygen.cfg.in [docs] Tell Doxygen to expand LLVM_ALIGNAS to nothing 2017-01-19 09:27:45 +00:00
index.rst [docs] Add TableGen-based generator for command line argument documentation, 2017-01-24 19:39:46 +00:00
make.bat

README.txt

See llvm/docs/README.txt