File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -5224,8 +5224,11 @@ TypeVariableType : public TypeBase {
5224
5224
TypeVariableType (const ASTContext &C, unsigned ID)
5225
5225
: TypeBase (TypeKind::TypeVariable, &C,
5226
5226
RecursiveTypeProperties::HasTypeVariable) {
5227
- // Note: the ID may overflow, but its only used for printing .
5227
+ // Note: the ID may overflow (current limit is 2^20 - 1) .
5228
5228
Bits.TypeVariableType .ID = ID;
5229
+ if (Bits.TypeVariableType .ID != ID) {
5230
+ llvm::report_fatal_error (" Type variable id overflow" );
5231
+ }
5229
5232
}
5230
5233
5231
5234
class Implementation ;
@@ -5261,8 +5264,10 @@ TypeVariableType : public TypeBase {
5261
5264
return reinterpret_cast <Implementation *>(this + 1 );
5262
5265
}
5263
5266
5264
- // / Type variable IDs are not globally unique and are only meant as a visual
5265
- // / aid when dumping AST.
5267
+ // / Type variable IDs are not globally unique and are
5268
+ // / used in equivalence class merging (so representative
5269
+ // / is always a type variable with smaller id), as well
5270
+ // / as a visual aid when dumping AST.
5266
5271
unsigned getID () const { return Bits.TypeVariableType .ID ; }
5267
5272
5268
5273
// Implement isa/cast/dyncast/etc.
You can’t perform that action at this time.
0 commit comments