Frontend: add a frontend argument to pass down block list config file path

This commit is contained in:
Xi Ge
2023-04-05 12:20:49 -07:00
parent ba31c97d4f
commit 2c2431e2da
4 changed files with 13 additions and 0 deletions

View File

@@ -556,6 +556,9 @@ namespace swift {
/// The model of concurrency to be used. /// The model of concurrency to be used.
ConcurrencyModel ActiveConcurrencyModel = ConcurrencyModel::Standard; ConcurrencyModel ActiveConcurrencyModel = ConcurrencyModel::Standard;
/// All block list configuration files to be honored in this compilation.
std::vector<std::string> BlocklistConfigFilePath;
bool isConcurrencyModelTaskToThread() const { bool isConcurrencyModelTaskToThread() const {
return ActiveConcurrencyModel == ConcurrencyModel::TaskToThread; return ActiveConcurrencyModel == ConcurrencyModel::TaskToThread;
} }

View File

@@ -240,6 +240,9 @@ def Raccess_note : Separate<["-"], "Raccess-note">,
def Raccess_note_EQ : Joined<["-"], "Raccess-note=">, def Raccess_note_EQ : Joined<["-"], "Raccess-note=">,
Alias<Raccess_note>; Alias<Raccess_note>;
def block_list_file
: Separate<["-"], "blocklist-file">, MetaVarName<"<path>">,
HelpText<"The path to a blocklist configuration file">;
} // end let Flags = [FrontendOption, NoDriverOption] } // end let Flags = [FrontendOption, NoDriverOption]
def debug_crash_Group : OptionGroup<"<automatic crashing options>">; def debug_crash_Group : OptionGroup<"<automatic crashing options>">;

View File

@@ -707,6 +707,10 @@ ASTContext::ASTContext(
registerNameLookupRequestFunctions(evaluator); registerNameLookupRequestFunctions(evaluator);
createModuleToExecutablePluginMap(); createModuleToExecutablePluginMap();
// Insert all block list config paths.
for (auto path: langOpts.BlocklistConfigFilePath) {
blockListConfig.addConfigureFilePath(path);
}
} }
ASTContext::~ASTContext() { ASTContext::~ASTContext() {

View File

@@ -1164,6 +1164,9 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
Opts.DumpTypeWitnessSystems = Args.hasArg(OPT_dump_type_witness_systems); Opts.DumpTypeWitnessSystems = Args.hasArg(OPT_dump_type_witness_systems);
for (auto A : Args.getAllArgValues(options::OPT_block_list_file)) {
Opts.BlocklistConfigFilePath.push_back(A);
}
if (const Arg *A = Args.getLastArg(options::OPT_concurrency_model)) { if (const Arg *A = Args.getLastArg(options::OPT_concurrency_model)) {
Opts.ActiveConcurrencyModel = Opts.ActiveConcurrencyModel =
llvm::StringSwitch<ConcurrencyModel>(A->getValue()) llvm::StringSwitch<ConcurrencyModel>(A->getValue())