Skip to content

Commit 04f23fc

Browse files
committed
Basics: refactor blocklist actions to a def file. NFC
1 parent 2836ee3 commit 04f23fc

File tree

3 files changed

+29
-6
lines changed

3 files changed

+29
-6
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

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;

0 commit comments

Comments
 (0)