using namespace clang::driver;
using namespace llvm::opt;
-SanitizerArgs::SanitizerArgs()
- : Kind(0), BlacklistFile(""), MsanTrackOrigins(false),
- AsanZeroBaseShadow(false), UbsanTrapOnError(false) {}
+void SanitizerArgs::clear() {
+ Kind = 0;
+ BlacklistFile = "";
+ MsanTrackOrigins = false;
+ AsanZeroBaseShadow = false;
+ UbsanTrapOnError = false;
+}
+
+SanitizerArgs::SanitizerArgs() {
+ clear();
+}
SanitizerArgs::SanitizerArgs(const ToolChain &TC,
- const llvm::opt::ArgList &Args)
- : Kind(0), BlacklistFile(""), MsanTrackOrigins(false),
- AsanZeroBaseShadow(false) {
+ const llvm::opt::ArgList &Args) {
+ clear();
+ parse(TC, Args);
+}
+
+void SanitizerArgs::parse(const ToolChain &TC,
+ const llvm::opt::ArgList &Args) {
unsigned AllKinds = 0; // All kinds of sanitizers that were turned on
// at least once (possibly, disabled further).
const Driver &D = TC.getDriver();
/// Parses the sanitizer arguments from an argument list.
SanitizerArgs(const ToolChain &TC, const llvm::opt::ArgList &Args);
+ void parse(const ToolChain &TC, const llvm::opt::ArgList &Args);
+
bool needsAsanRt() const { return Kind & NeedsAsanRt; }
bool needsTsanRt() const { return Kind & NeedsTsanRt; }
bool needsMsanRt() const { return Kind & NeedsMsanRt; }
llvm::opt::ArgStringList &CmdArgs) const;
private:
+ void clear();
+
/// Parse a single value from a -fsanitize= or -fno-sanitize= value list.
/// Returns OR of members of the \c SanitizeKind enumeration, or \c 0
/// if \p Value is not known.