mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #7921 from devincoughlin/sil_sanitizer_options
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
#ifndef SWIFT_AST_SILOPTIONS_H
|
#ifndef SWIFT_AST_SILOPTIONS_H
|
||||||
#define SWIFT_AST_SILOPTIONS_H
|
#define SWIFT_AST_SILOPTIONS_H
|
||||||
|
|
||||||
|
#include "swift/Basic/Sanitizers.h"
|
||||||
#include "llvm/ADT/StringRef.h"
|
#include "llvm/ADT/StringRef.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <climits>
|
#include <climits>
|
||||||
@@ -122,6 +123,12 @@ public:
|
|||||||
|
|
||||||
/// Assume that code will be executed in a single-threaded environment.
|
/// Assume that code will be executed in a single-threaded environment.
|
||||||
bool AssumeSingleThreaded = false;
|
bool AssumeSingleThreaded = false;
|
||||||
|
|
||||||
|
/// Indicates which sanitizer is turned on.
|
||||||
|
SanitizerKind Sanitize : 2;
|
||||||
|
|
||||||
|
SILOptions() : Sanitize(SanitizerKind::None) {}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace swift
|
} // end namespace swift
|
||||||
|
|||||||
@@ -1114,7 +1114,8 @@ static void PrintArg(raw_ostream &OS, const char *Arg, bool Quote) {
|
|||||||
static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
|
static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
|
||||||
IRGenOptions &IRGenOpts,
|
IRGenOptions &IRGenOpts,
|
||||||
FrontendOptions &FEOpts,
|
FrontendOptions &FEOpts,
|
||||||
DiagnosticEngine &Diags) {
|
DiagnosticEngine &Diags,
|
||||||
|
const llvm::Triple &Triple) {
|
||||||
using namespace options;
|
using namespace options;
|
||||||
|
|
||||||
if (const Arg *A = Args.getLastArg(OPT_sil_inline_threshold)) {
|
if (const Arg *A = Args.getLastArg(OPT_sil_inline_threshold)) {
|
||||||
@@ -1228,6 +1229,12 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
|
|||||||
BaseName = FEOpts.ModuleName;
|
BaseName = FEOpts.ModuleName;
|
||||||
Opts.SILOutputFileNameForDebugging = BaseName.str();
|
Opts.SILOutputFileNameForDebugging = BaseName.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (const Arg *A = Args.getLastArg(options::OPT_sanitize_EQ)) {
|
||||||
|
Opts.Sanitize = parseSanitizerArgValues(A, Triple, Diags);
|
||||||
|
IRGenOpts.Sanitize = Opts.Sanitize;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1403,10 +1410,6 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (const Arg *A = Args.getLastArg(options::OPT_sanitize_EQ)) {
|
|
||||||
Opts.Sanitize = parseSanitizerArgValues(A, Triple, Diags);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (const Arg *A = Args.getLastArg(options::OPT_sanitize_coverage_EQ)) {
|
if (const Arg *A = Args.getLastArg(options::OPT_sanitize_coverage_EQ)) {
|
||||||
Opts.SanitizeCoverage =
|
Opts.SanitizeCoverage =
|
||||||
parseSanitizerCoverageArgValue(A, Triple, Diags, Opts.Sanitize);
|
parseSanitizerCoverageArgValue(A, Triple, Diags, Opts.Sanitize);
|
||||||
@@ -1474,7 +1477,8 @@ bool CompilerInvocation::parseArgs(ArrayRef<const char *> Args,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ParseSILArgs(SILOpts, ParsedArgs, IRGenOpts, FrontendOpts, Diags)) {
|
if (ParseSILArgs(SILOpts, ParsedArgs, IRGenOpts, FrontendOpts, Diags,
|
||||||
|
LangOpts.Target)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user