================
@@ -2808,10 +2806,10 @@ RecordRecTy *Record::getType() {
   return RecordRecTy::get(TrackedRecords, DirectSCs);
 }
 
-DefInit *Record::getDefInit() {
+DefInit *Record::getDefInit() const {
   if (!CorrespondingDefInit) {
-    CorrespondingDefInit =
-        new (TrackedRecords.getImpl().Allocator) DefInit(this);
+    CorrespondingDefInit = new (TrackedRecords.getImpl().Allocator)
+        DefInit(const_cast<Record *>(this));
----------------
jurahul wrote:

The only issue/smell is here, where CodeGenDAGPatterns.cpp and 
CodeGenRegisters.cpp call DefInit::get() on the result of a SetTheory::expand() 
returned record (which is now const *). I looked a little bit to see what they 
are doing, but decided to "cut off" the change here to keep it smaller. This is 
part of effort to have better const correctness w.r.t records and recordkeeper, 
so with this, the "smell" is atleast localized to this function and we can have 
const records otherwise.

https://github.com/llvm/llvm-project/pull/107692
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to