File tree Expand file tree Collapse file tree 2 files changed +9
-18
lines changed Expand file tree Collapse file tree 2 files changed +9
-18
lines changed Original file line number Diff line number Diff line change @@ -30,12 +30,6 @@ enum class DiagID : uint32_t;
30
30
31
31
namespace swift {
32
32
namespace diag {
33
-
34
- struct DiagnosticNode {
35
- uint32_t id;
36
- std::string msg;
37
- };
38
-
39
33
class LocalizationProducer {
40
34
public:
41
35
// / If the message isn't available/localized in the current `yaml` file,
Original file line number Diff line number Diff line change @@ -31,6 +31,11 @@ enum LocalDiagID : uint32_t {
31
31
#include " swift/AST/DiagnosticsAll.def"
32
32
NumDiags
33
33
};
34
+
35
+ struct DiagnosticNode {
36
+ uint32_t id;
37
+ std::string msg;
38
+ };
34
39
} // namespace
35
40
36
41
namespace llvm {
@@ -44,26 +49,18 @@ template <> struct ScalarEnumerationTraits<LocalDiagID> {
44
49
}
45
50
};
46
51
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;
53
55
io.mapRequired (" id" , diagID);
54
56
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);
59
58
}
60
59
};
61
60
62
61
} // namespace yaml
63
62
} // namespace llvm
64
63
65
- LLVM_YAML_IS_SEQUENCE_VECTOR (swift::diag::DiagnosticNode)
66
-
67
64
namespace swift {
68
65
namespace diag {
69
66
You can’t perform that action at this time.
0 commit comments