Skip to content

Commit 8c20494

Browse files
authored
Merge pull request #65024 from nkcsgexi/block-list-frontend
2 parents e5dbe30 + 04f23fc commit 8c20494

File tree

8 files changed

+37
-11
lines changed

8 files changed

+37
-11
lines changed

include/swift/Basic/BlockList.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ namespace swift {
2525

2626
enum class BlockListAction: uint8_t {
2727
Undefined = 0,
28-
ShouldUseBinaryModule,
29-
ShouldUseTextualModule,
28+
#define BLOCKLIST_ACTION(NAME) NAME,
29+
#include "BlockListAction.def"
3030
};
3131

3232
enum class BlockListKeyKind: uint8_t {
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//===--- BlockListAction.def - Define all blocklist actions -----*- C++ -*-===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2014 - 2023 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
//
13+
// This definition file describes all block list actions for meta-programming
14+
// purposes.
15+
//
16+
//===----------------------------------------------------------------------===//
17+
18+
#ifndef BLOCKLIST_ACTION
19+
#define BLOCKLIST_ACTION(NAME)
20+
#endif
21+
22+
BLOCKLIST_ACTION(ShouldUseBinaryModule)
23+
BLOCKLIST_ACTION(ShouldUseTextualModule)
24+
25+
#undef BLOCKLIST_ACTION

include/swift/Basic/LangOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ namespace swift {
557557
ConcurrencyModel ActiveConcurrencyModel = ConcurrencyModel::Standard;
558558

559559
/// All block list configuration files to be honored in this compilation.
560-
std::vector<std::string> BlocklistConfigFilePath;
560+
std::vector<std::string> BlocklistConfigFilePaths;
561561

562562
bool isConcurrencyModelTaskToThread() const {
563563
return ActiveConcurrencyModel == ConcurrencyModel::TaskToThread;

include/swift/Frontend/FrontendOptions.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,8 @@ class FrontendOptions {
510510
/// textual imports
511511
bool EmitClangHeaderWithNonModularIncludes = false;
512512

513+
/// All block list configuration files to be honored in this compilation.
514+
std::vector<std::string> BlocklistConfigFilePaths;
513515
private:
514516
static bool canActionEmitDependencies(ActionType);
515517
static bool canActionEmitReferenceDependencies(ActionType);

lib/AST/ASTContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ ASTContext::ASTContext(
718718
if (!OutputBackend)
719719
OutputBackend = llvm::makeIntrusiveRefCnt<llvm::vfs::OnDiskOutputBackend>();
720720
// Insert all block list config paths.
721-
for (auto path: langOpts.BlocklistConfigFilePath) {
721+
for (auto path: langOpts.BlocklistConfigFilePaths) {
722722
blockListConfig.addConfigureFilePath(path);
723723
}
724724
}

lib/Basic/BlockList.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,8 @@ void swift::BlockListStore::Implementation::addConfigureFilePath(StringRef path)
115115
for (auto &pair: *dyn_cast<yaml::MappingNode>(N)) {
116116
std::string key = getScalaString(pair.getKey());
117117
auto action = llvm::StringSwitch<BlockListAction>(key)
118-
#define CASE(X) .Case(#X, BlockListAction::X)
119-
CASE(ShouldUseBinaryModule)
120-
CASE(ShouldUseTextualModule)
121-
#undef CASE
118+
#define BLOCKLIST_ACTION(X) .Case(#X, BlockListAction::X)
119+
#include "swift/Basic/BlockListAction.def"
122120
.Default(BlockListAction::Undefined);
123121
if (action == BlockListAction::Undefined)
124122
continue;

lib/Frontend/ArgsToFrontendOptionsConverter.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,9 @@ bool ArgsToFrontendOptionsConverter::convert(
346346
}
347347
Opts.emptyABIDescriptor = Args.hasArg(OPT_empty_abi_descriptor);
348348
Opts.DeterministicCheck = Args.hasArg(OPT_enable_deterministic_check);
349+
for (auto A : Args.getAllArgValues(options::OPT_block_list_file)) {
350+
Opts.BlocklistConfigFilePaths.push_back(A);
351+
}
349352
return false;
350353
}
351354

lib/Frontend/CompilerInvocation.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,9 +1177,7 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
11771177

11781178
Opts.DumpTypeWitnessSystems = Args.hasArg(OPT_dump_type_witness_systems);
11791179

1180-
for (auto A : Args.getAllArgValues(options::OPT_block_list_file)) {
1181-
Opts.BlocklistConfigFilePath.push_back(A);
1182-
}
1180+
Opts.BlocklistConfigFilePaths = FrontendOpts.BlocklistConfigFilePaths;
11831181
if (const Arg *A = Args.getLastArg(options::OPT_concurrency_model)) {
11841182
Opts.ActiveConcurrencyModel =
11851183
llvm::StringSwitch<ConcurrencyModel>(A->getValue())

0 commit comments

Comments
 (0)