1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
//=== driver/cl_options_sanitizers.h - LDC command line options -*- C++ -*-===//
//
// LDC – the LLVM D compiler
//
// This file is distributed under the BSD-style LDC license. See the LICENSE
// file for details.
//
//===----------------------------------------------------------------------===//
//
// Deals with -fsanitize=...
//
//===----------------------------------------------------------------------===//
#pragma once
#include "gen/cl_helpers.h"
#include "llvm/Transforms/Instrumentation.h"
class FuncDeclaration;
namespace llvm {
class raw_ostream;
class StringRef;
}
namespace opts {
namespace cl = llvm::cl;
typedef unsigned SanitizerBits;
enum SanitizerCheck : SanitizerBits {
NoneSanitizer = 0,
AddressSanitizer = 1 << 0,
FuzzSanitizer = 1 << 1,
MemorySanitizer = 1 << 2,
ThreadSanitizer = 1 << 3,
CoverageSanitizer = 1 << 4,
LeakSanitizer = 1 << 5,
};
extern SanitizerBits enabledSanitizers;
inline bool isAnySanitizerEnabled() { return enabledSanitizers; }
inline bool isSanitizerEnabled(SanitizerBits san) {
return enabledSanitizers & san;
}
SanitizerCheck parseSanitizerName(llvm::StringRef name,
std::function<void()> actionUponError);
void initializeSanitizerOptionsFromCmdline();
llvm::SanitizerCoverageOptions getSanitizerCoverageOptions();
void outputSanitizerSettings(llvm::raw_ostream &hash_os);
bool functionIsInSanitizerBlacklist(FuncDeclaration *funcDecl);
} // namespace opts
|