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 {
584584 assert (isLive () && " Invalid pointer" );
585585 assert (isBlockPointer ());
586586 assert (asBlockPointer ().Pointee );
587+ assert (isDereferencable ());
587588 assert (Offset + sizeof (T) <=
588589 asBlockPointer ().Pointee ->getDescriptor ()->getAllocSize ());
589590
@@ -603,6 +604,17 @@ class Pointer {
603604 sizeof (InitMapPtr))[I];
604605 }
605606
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+
606618 // / Initializes a field.
607619 void initialize () const ;
608620 // / Activats a field.
You can’t perform that action at this time.
0 commit comments