diff options
Diffstat (limited to 'docs/UsersManual.rst')
-rw-r--r-- | docs/UsersManual.rst | 61 |
1 files changed, 53 insertions, 8 deletions
diff --git a/docs/UsersManual.rst b/docs/UsersManual.rst index fc5af4ecd5b1..2a6fc82a90de 100644 --- a/docs/UsersManual.rst +++ b/docs/UsersManual.rst @@ -589,6 +589,25 @@ Current limitations translated from debug annotations. That translation can be lossy, which results in some remarks having no location information. +Other Options +------------- +Clang options that that don't fit neatly into other categories. + +.. option:: -MV + + When emitting a dependency file, use formatting conventions appropriate + for NMake or Jom. Ignored unless another option causes Clang to emit a + dependency file. + +When Clang emits a dependency file (e.g., you supplied the -M option) +most filenames can be written to the file without any special formatting. +Different Make tools will treat different sets of characters as "special" +and use different conventions for telling the Make tool that the character +is actually part of the filename. Normally Clang uses backslash to "escape" +a special character, which is the convention used by GNU Make. The -MV +option tells Clang to put double-quotes around the entire filename, which +is the convention used by NMake and Jom. + Language and Target-Independent Features ======================================== @@ -637,7 +656,7 @@ Diagnostics <cl_diag_formatting>`. Diagnostic Mappings ^^^^^^^^^^^^^^^^^^^ -All diagnostics are mapped into one of these 5 classes: +All diagnostics are mapped into one of these 6 classes: - Ignored - Note @@ -911,6 +930,8 @@ number of cases where the compilation environment is tightly controlled and the precompiled header cannot be generated after headers have been installed. +.. _controlling-code-generation: + Controlling Code Generation --------------------------- @@ -957,6 +978,8 @@ are listed below. ``unsigned-integer-overflow`` and ``vptr``. - ``-fsanitize=dataflow``: :doc:`DataFlowSanitizer`, a general data flow analysis. + - ``-fsanitize=cfi``: :doc:`control flow integrity <ControlFlowIntegrity>` + checks. Implies ``-flto``. The following more fine-grained checks are also available: @@ -966,6 +989,16 @@ are listed below. ``true`` nor ``false``. - ``-fsanitize=bounds``: Out of bounds array indexing, in cases where the array bound can be statically determined. + - ``-fsanitize=cfi-cast-strict``: Enables :ref:`strict cast checks + <cfi-strictness>`. + - ``-fsanitize=cfi-derived-cast``: Base-to-derived cast to the wrong + dynamic type. Implies ``-flto``. + - ``-fsanitize=cfi-unrelated-cast``: Cast from ``void*`` or another + unrelated type to the wrong dynamic type. Implies ``-flto``. + - ``-fsanitize=cfi-nvcall``: Non-virtual call via an object whose vptr is of + the wrong dynamic type. Implies ``-flto``. + - ``-fsanitize=cfi-vcall``: Virtual call via an object whose vptr is of the + wrong dynamic type. Implies ``-flto``. - ``-fsanitize=enum``: Load of a value of an enumerated type which is not in the range of representable values for that enumerated type. @@ -994,7 +1027,9 @@ are listed below. greater or equal to the promoted bit-width of the left hand side or less than zero, or where the left hand side is negative. For a signed left shift, also checks for signed overflow in C, and for - unsigned overflow in C++. + unsigned overflow in C++. You can use ``-fsanitize=shift-base`` or + ``-fsanitize=shift-exponent`` to check only left-hand side or + right-hand side of shift operation, respectively. - ``-fsanitize=signed-integer-overflow``: Signed integer overflow, including all the checks added by ``-ftrapv``, and checking for overflow in signed division (``INT_MIN / -1``). @@ -1026,10 +1061,11 @@ are listed below. uninitialized bits came from. Slows down execution by additional 1.5x-2x. - Possible values for level are 0 (off), 1 (default), 2. Level 2 adds more - sections to MemorySanitizer reports describing the order of memory stores - the uninitialized value went through. Beware, this mode may use a lot of - extra memory. + Possible values for level are 0 (off), 1, 2 (default). Level 2 + adds more sections to MemorySanitizer reports describing the + order of memory stores the uninitialized value went + through. This mode may use extra memory in programs that copy + uninitialized memory a lot. Extra features of UndefinedBehaviorSanitizer: @@ -1049,8 +1085,8 @@ are listed below. It is not possible to combine more than one of the ``-fsanitize=address``, ``-fsanitize=thread``, and ``-fsanitize=memory`` checkers in the same - program. The ``-fsanitize=undefined`` checks can be combined with other - sanitizers. + program. The ``-fsanitize=undefined`` checks can only be combined with + ``-fsanitize=address``. **-f[no-]sanitize-recover=check1,check2,...** @@ -1063,6 +1099,11 @@ are listed below. sanitizers (e.g. :doc:`AddressSanitizer`) may not support recovery, and always crash the program after the issue is detected. +**-f[no-]sanitize-coverage=[type,features,...]** + + Enable simple code coverage in addition to certain sanitizers. + See :doc:`SanitizerCoverage` for more details. + .. option:: -fno-assume-sane-operator-new Don't assume that the C++'s new operator is sane. @@ -1249,6 +1290,10 @@ If you are not using Linux Perf to collect profiles, you will need to write a conversion tool from your profiler to LLVM's format. This section explains the file format expected by the backend. +NOTE: This format is not intended to be used for code coverage. For that, +you need to use Clang's instrumentation based profiling +(``-fprofile-instr-generate``). + Sample profiles are written as ASCII text. The file is divided into sections, which correspond to each of the functions executed at runtime. Each section has the following format (taken from |