Quellcode durchsuchen

Mark VtablePtr always constant (#5843)

Jon Ross-Perkins vor 9 Monaten
Ursprung
Commit
6bf335c309
2 geänderte Dateien mit 1 neuen und 7 gelöschten Zeilen
  1. 0 5
      toolchain/lower/handle.cpp
  2. 1 2
      toolchain/sem_ir/typed_insts.h

+ 0 - 5
toolchain/lower/handle.cpp

@@ -300,9 +300,4 @@ auto HandleInst(FunctionContext& context, SemIR::InstId inst_id,
                    context.CreateAlloca(context.GetTypeOfInst(inst_id)));
 }
 
-auto HandleInst(FunctionContext& /*context*/, SemIR::InstId /*inst_id*/,
-                SemIR::VtablePtr /*inst*/) -> void {
-  CARBON_FATAL("`VtablePtr` insts should always be constant");
-}
-
 }  // namespace Carbon::Lower

+ 1 - 2
toolchain/sem_ir/typed_insts.h

@@ -1779,8 +1779,7 @@ struct VtableType {
 // Initializer for virtual function table pointers in object initialization.
 struct VtablePtr {
   static constexpr auto Kind = InstKind::VtablePtr.Define<Parse::NodeId>(
-      {.ir_name = "vtable_ptr",
-       .constant_kind = InstConstantKind::WheneverPossible});
+      {.ir_name = "vtable_ptr", .constant_kind = InstConstantKind::Always});
   TypeId type_id;
   VtableId vtable_id;
   SpecificId specific_id;