mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-07 03:16:05 +03:00
Replace -sanitize
with -fsanitize
and add -fsanitize-coverage
. (#2149)
This reworks the sanitizer interface to be identical with Clang's. What's left to do is pass the correct runtime libraries to the linker.
This commit is contained in:
parent
b82d87d6ee
commit
22b1accb59
14 changed files with 388 additions and 37 deletions
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include "errors.h"
|
||||
#include "driver/cl_options.h"
|
||||
#include "driver/cl_options_sanitizers.h"
|
||||
#include "driver/exe_path.h"
|
||||
#include "driver/tool.h"
|
||||
#include "gen/irstate.h"
|
||||
|
@ -242,13 +243,17 @@ void ArgsBuilder::build(llvm::StringRef outputPath,
|
|||
|
||||
// Requires clang.
|
||||
void ArgsBuilder::addSanitizers() {
|
||||
if (opts::sanitize == opts::AddressSanitizer) {
|
||||
// TODO: instead of this, we should link with our own sanitizer libraries
|
||||
// because LDC's LLVM version could be different from the system clang.
|
||||
if (opts::isSanitizerEnabled(opts::AddressSanitizer)) {
|
||||
args.push_back("-fsanitize=address");
|
||||
}
|
||||
if (opts::sanitize == opts::MemorySanitizer) {
|
||||
|
||||
if (opts::isSanitizerEnabled(opts::MemorySanitizer)) {
|
||||
args.push_back("-fsanitize=memory");
|
||||
}
|
||||
if (opts::sanitize == opts::ThreadSanitizer) {
|
||||
|
||||
if (opts::isSanitizerEnabled(opts::ThreadSanitizer)) {
|
||||
args.push_back("-fsanitize=thread");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue