@@ -75,7 +75,7 @@ namespace {
75
75
// / Float and integer literals are additionally keyed by numeric equivalence.
76
76
struct RawValueKey {
77
77
enum class Kind : uint8_t {
78
- String, Float, Int, Tombstone, Empty
78
+ String, Float, Int, Bool, Tombstone, Empty
79
79
} kind;
80
80
81
81
struct IntValueTy {
@@ -101,6 +101,7 @@ struct RawValueKey {
101
101
StringRef stringValue;
102
102
IntValueTy intValue;
103
103
FloatValueTy floatValue;
104
+ bool boolValue;
104
105
};
105
106
106
107
explicit RawValueKey (LiteralExpr *expr) {
@@ -136,6 +137,12 @@ struct RawValueKey {
136
137
kind = Kind::String;
137
138
stringValue = cast<StringLiteralExpr>(expr)->getValue ();
138
139
return ;
140
+
141
+ case ExprKind::BooleanLiteral:
142
+ kind = Kind::Bool;
143
+ boolValue = cast<BooleanLiteralExpr>(expr)->getValue ();
144
+ return ;
145
+
139
146
default :
140
147
llvm_unreachable (" not a valid literal expr for raw value" );
141
148
}
@@ -183,6 +190,8 @@ class DenseMapInfo<RawValueKey> {
183
190
DenseMapInfo<uint64_t >::getHashValue (k.intValue .v1 );
184
191
case RawValueKey::Kind::String:
185
192
return DenseMapInfo<StringRef>::getHashValue (k.stringValue );
193
+ case RawValueKey::Kind::Bool:
194
+ return DenseMapInfo<uint64_t >::getHashValue (k.boolValue );
186
195
case RawValueKey::Kind::Empty:
187
196
case RawValueKey::Kind::Tombstone:
188
197
return 0 ;
@@ -204,6 +213,8 @@ class DenseMapInfo<RawValueKey> {
204
213
a.intValue .v1 == b.intValue .v1 ;
205
214
case RawValueKey::Kind::String:
206
215
return a.stringValue .equals (b.stringValue );
216
+ case RawValueKey::Kind::Bool:
217
+ return a.boolValue == b.boolValue ;
207
218
case RawValueKey::Kind::Empty:
208
219
case RawValueKey::Kind::Tombstone:
209
220
return true ;
@@ -1682,6 +1693,7 @@ EnumRawValuesRequest::evaluate(Evaluator &eval, EnumDecl *ED,
1682
1693
continue ;
1683
1694
}
1684
1695
1696
+
1685
1697
// If the raw values of the enum case are fixed, then we trust our callers
1686
1698
// to have set things up correctly. This comes up with imported enums
1687
1699
// and deserialized @objc enums which always have their raw values setup
0 commit comments