File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -584,6 +584,7 @@ class Pointer {
584
584
assert (isLive () && " Invalid pointer" );
585
585
assert (isBlockPointer ());
586
586
assert (asBlockPointer ().Pointee );
587
+ assert (isDereferencable ());
587
588
assert (Offset + sizeof (T) <=
588
589
asBlockPointer ().Pointee ->getDescriptor ()->getAllocSize ());
589
590
@@ -603,6 +604,17 @@ class Pointer {
603
604
sizeof (InitMapPtr))[I];
604
605
}
605
606
607
+ // / Whether this block can be read from at all. This is only true for
608
+ // / block pointers that point to a valid location inside that block.
609
+ bool isDereferencable () const {
610
+ if (!isBlockPointer ())
611
+ return false ;
612
+ if (isPastEnd ())
613
+ return false ;
614
+
615
+ return true ;
616
+ }
617
+
606
618
// / Initializes a field.
607
619
void initialize () const ;
608
620
// / Activats a field.
You can’t perform that action at this time.
0 commit comments