llvm-project/clang/lib/Driver
Filipe Cabecinhas ec5d0e6423 Improve our handling of rtti/sanitize=vptr/sanitize=undefined
This patch removes the huge blob of code that is dealing with
rtti/exceptions/sanitizers and replaces it with:

A ToolChain function which, for a given set of Args, figures out if rtti
should be:
  - enabled
  - disabled implicitly
  - disabled explicitly

A change in the way SanitizerArgs figures out what sanitizers to enable
(or if it should error out, or warn);

And a check for exceptions/rtti interaction inside addExceptionArgs.

The RTTIMode algorithm is:
  - If -mkernel, -fapple-kext, or -fno-rtti are passed, rtti was disabled explicitly;
  - If -frtti was passed or we're not targetting the PS4, rtti is enabled;
  - If -fexceptions or -fcxx-exceptions was passed and we're targetting
    the PS4, rtti was enabled implicitly;
  - If we're targetting the PS4, rtti is disabled implicitly;
  - Otherwise, rtti is enabled;

Since the only flag needed to pass to -cc1 is -fno-rtti if we want to
disable it, there's no problem in saying rtti is enabled if we're
compiling C code, so we don't look at the input file type.

addExceptionArgs now looks at the RTTIMode and warns that rtti is being
enabled implicitly if targetting the PS4 and exceptions are on. It also
errors out if, targetting the PS4, -fno-rtti was passed, and exceptions
were turned on.

SanitizerArgs now errors out if rtti was disabled explicitly and the vptr
sanitizer was enabled implicitly, but just turns off vptr if rtti is
disabled but -fsanitize=undefined was passed.

Also fixed tests, removed duplicate name from addExceptionArgs comment,
and added one or two surrounding lines when running clang-format.
This changes test/Driver/fsanitize.c to make it not expect a warning when
passed -fsanitize=undefined -fno-rtti, but expect vptr to not be on.

Removed all users and definition of SanitizerArgs::sanitizesVptr().

Reviewers: samsonov

Subscribers: llvm-commits, samsonov, rsmith

Differential Revision: http://reviews.llvm.org/D7525

llvm-svn: 229801
2015-02-19 01:04:49 +00:00
..
Action.cpp Reapply "Change -save-temps to emit unoptimized bitcode files." 2014-12-21 07:00:00 +00:00
CMakeLists.txt Driver: add CrossWindowsToolChain 2014-10-24 03:13:37 +00:00
Compilation.cpp Driver: Use pointee_iterator rather than iterating over unique_ptrs 2014-10-03 01:04:53 +00:00
CrossWindowsToolChain.cpp Driver: correct typo 2014-11-19 17:59:00 +00:00
Driver.cpp PR 17421: Implemented -save-temps={obj|cwd} option 2015-02-02 22:41:48 +00:00
DriverOptions.cpp Remove the SUPPORT_ALIASARGS define 2013-08-01 00:12:13 +00:00
InputInfo.h Header guard canonicalization, clang part. 2014-08-13 16:25:19 +00:00
Job.cpp Prefer SmallVector::append/insert over push_back loops. Clang edition. 2015-02-17 16:48:30 +00:00
MSVCToolChain.cpp Remove a stray blank line that my sort_include.py script found. 2015-02-13 09:57:05 +00:00
Makefile
Multilib.cpp Driver: Simplify a use of the path API 2014-08-03 21:46:33 +00:00
Phases.cpp Reapply "Change -save-temps to emit unoptimized bitcode files." 2014-12-21 07:00:00 +00:00
SanitizerArgs.cpp Improve our handling of rtti/sanitize=vptr/sanitize=undefined 2015-02-19 01:04:49 +00:00
Tool.cpp Teach Clang how to use response files when calling other tools 2014-09-15 17:45:39 +00:00
ToolChain.cpp Improve our handling of rtti/sanitize=vptr/sanitize=undefined 2015-02-19 01:04:49 +00:00
ToolChains.cpp Driver: Fix use of dangling std::string temporary 2015-02-18 18:45:54 +00:00
ToolChains.h Do not force "-static" for aarch64 iOS kernel/kext assembly code. 2015-02-10 06:33:04 +00:00
Tools.cpp Improve our handling of rtti/sanitize=vptr/sanitize=undefined 2015-02-19 01:04:49 +00:00
Tools.h [mips] Pass ABI name via -target-abi instead of target-features 2015-01-30 17:35:23 +00:00
Types.cpp Reapply "Change -save-temps to emit unoptimized bitcode files." 2014-12-21 07:00:00 +00:00