Reimplement -fsanitize-recover family of flags.
authorAlexey Samsonov <vonosmas@gmail.com>
Mon, 12 Jan 2015 22:39:12 +0000 (22:39 +0000)
committerAlexey Samsonov <vonosmas@gmail.com>
Mon, 12 Jan 2015 22:39:12 +0000 (22:39 +0000)
commit8845952b54a7574cedbbd0661e889cd4e2d5947b
treecac9ea08214180cb195bc54409842254053fa5f4
parentd88ab87064d9b366393d58066f3bee8111f6cec4
Reimplement -fsanitize-recover family of flags.

Introduce the following -fsanitize-recover flags:
  - -fsanitize-recover=<list>: Enable recovery for selected checks or
      group of checks. It is forbidden to explicitly list unrecoverable
      sanitizers here (that is, "address", "unreachable", "return").
  - -fno-sanitize-recover=<list>: Disable recovery for selected checks or
     group of checks.
  - -f(no-)?sanitize-recover is now a synonym for
    -f(no-)?sanitize-recover=undefined,integer and will soon be deprecated.

These flags are parsed left to right, and mask of "recoverable"
sanitizer is updated accordingly, much like what we do for -fsanitize= flags.
-fsanitize= and -fsanitize-recover= flag families are independent.

CodeGen change: If there is a single UBSan handler function, responsible
for implementing multiple checks, which have different recoverable setting,
then we emit two handler calls instead of one:
the first one for the set of "unrecoverable" checks, another one - for
set of "recoverable" checks. If all checks implemented by a handler have the
same recoverability setting, then the generated code will be the same.

llvm-svn: 225719
14 files changed:
clang/docs/UsersManual.rst
clang/include/clang/Driver/Options.td
clang/include/clang/Driver/SanitizerArgs.h
clang/include/clang/Frontend/CodeGenOptions.def
clang/include/clang/Frontend/CodeGenOptions.h
clang/lib/CodeGen/CGExpr.cpp
clang/lib/Driver/SanitizerArgs.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/CodeGen/catch-undef-behavior.c
clang/test/CodeGen/compound-assign-overflow.c
clang/test/CodeGen/sanitize-recover.c
clang/test/CodeGen/ubsan-type-blacklist.cpp
clang/test/CodeGenCXX/catch-undef-behavior.cpp
clang/test/Driver/fsanitize.c