Change driver logic for sanitizers support.

With this patch different sanitizers (tsan/asan) will be enabled or
disabled on the driver level on a particular OS depending on whether
the required library is present.

The current patch only supports Darwin architectures, but Linux support
should not be hard to add.
This commit is contained in:
George Karpenkov
2017-06-13 17:08:51 -07:00
parent 3548c45423
commit 9637bd2c36
13 changed files with 139 additions and 83 deletions

View File

@@ -1420,7 +1420,14 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
}
if (const Arg *A = Args.getLastArg(options::OPT_sanitize_EQ)) {
Opts.Sanitize = parseSanitizerArgValues(A, Triple, Diags);
Opts.Sanitize = parseSanitizerArgValues(
A, Triple, Diags,
/* sanitizerRuntimeLibExists= */[&](const StringRef libName) {
// The driver has checked the existance of the library
// already.
return true;
});
IRGenOpts.Sanitize = Opts.Sanitize;
}