Enable output of variable names in ASan and MSan error reporting. (#4004)

This commit is contained in:
Johan Engelen 2022-06-26 11:13:33 +02:00 committed by GitHub
parent 421f3d1c0a
commit a2ce3f31b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 11 deletions

View file

@ -17,6 +17,7 @@
#include "dmd/scope.h"
#include "driver/cl_options.h"
#include "driver/cl_options_instrumentation.h"
#include "driver/cl_options_sanitizers.h"
#include "driver/linker.h"
#include "driver/toobj.h"
#include "gen/dynamiccompile.h"
@ -195,8 +196,11 @@ CodeGenerator::CodeGenerator(llvm::LLVMContext &context,
mlirContext_(mlirContext),
#endif
moduleCount_(0), singleObj_(singleObj), ir_(nullptr) {
// Set the context to discard value names when not generating textual IR.
if (!global.params.output_ll) {
// Set the context to discard value names when not generating textual IR and
// when ASan or MSan are not enabled.
if (!global.params.output_ll &&
!opts::isSanitizerEnabled(opts::AddressSanitizer |
opts::MemorySanitizer)) {
context_.setDiscardValueNames(true);
}
}