Skip to content

Commit 4d1160c

Browse files
Remove unnecessary comments & move DiagnosticNode
1 parent fd8b24a commit 4d1160c

File tree

2 files changed

+9
-18
lines changed

2 files changed

+9
-18
lines changed

include/swift/AST/LocalizationFormat.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ enum class DiagID : uint32_t;
3030

3131
namespace swift {
3232
namespace diag {
33-
34-
struct DiagnosticNode {
35-
uint32_t id;
36-
std::string msg;
37-
};
38-
3933
class LocalizationProducer {
4034
public:
4135
/// If the message isn't available/localized in the current `yaml` file,

lib/AST/LocalizationFormat.cpp

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ enum LocalDiagID : uint32_t {
3131
#include "swift/AST/DiagnosticsAll.def"
3232
NumDiags
3333
};
34+
35+
struct DiagnosticNode {
36+
uint32_t id;
37+
std::string msg;
38+
};
3439
} // namespace
3540

3641
namespace llvm {
@@ -44,26 +49,18 @@ template <> struct ScalarEnumerationTraits<LocalDiagID> {
4449
}
4550
};
4651

47-
template <> struct MappingTraits<swift::diag::DiagnosticNode> {
48-
static void mapping(IO &io, swift::diag::DiagnosticNode &node) {
49-
// Cast `uint32_t` to `LocalDiagID` to use `diagID` at
50-
// ScalarEnumerationTraits, because EnumerationTraits has to have an `id` of
51-
// type `LocalDiagID`
52-
auto diagID = static_cast<LocalDiagID>(node.id);
52+
template <> struct MappingTraits<DiagnosticNode> {
53+
static void mapping(IO &io, DiagnosticNode &node) {
54+
LocalDiagID diagID;
5355
io.mapRequired("id", diagID);
5456
io.mapRequired("msg", node.msg);
55-
// We will need to cast `diagID` back again to unsigned int, and assign it
56-
// to `node.id` because we will need the `uint32_t` value as it'll be used
57-
// to retrieve diagnostic nodes later.
58-
node.id = (unsigned)diagID;
57+
node.id = static_cast<uint32_t>(diagID);
5958
}
6059
};
6160

6261
} // namespace yaml
6362
} // namespace llvm
6463

65-
LLVM_YAML_IS_SEQUENCE_VECTOR(swift::diag::DiagnosticNode)
66-
6764
namespace swift {
6865
namespace diag {
6966

0 commit comments

Comments
 (0)