Skip to content

Commit 66e7168

Browse files
authored
[clang][bytecode][NFC] Use an early return in CheckLoad (#157105)
If the block is not accessible, one of the check has to fail.
1 parent 95f51f1 commit 66e7168

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

clang/lib/AST/ByteCode/Interp.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,7 @@ bool CheckLocalLoad(InterpState &S, CodePtr OpPC, const Block *B) {
792792

793793
bool CheckLoad(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
794794
AccessKinds AK) {
795+
// Block pointers are the only ones we can actually read from.
795796
if (!Ptr.isBlockPointer()) {
796797
if (Ptr.isZero()) {
797798
const auto &Src = S.Current->getSource(OpPC);
@@ -804,16 +805,14 @@ bool CheckLoad(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
804805
return false;
805806
}
806807

807-
// Block pointers are the only ones we can actually read from.
808808
if (!Ptr.block()->isAccessible()) {
809809
if (!CheckLive(S, OpPC, Ptr, AK))
810810
return false;
811811
if (!CheckExtern(S, OpPC, Ptr))
812812
return false;
813813
if (!CheckDummy(S, OpPC, Ptr.block(), AK))
814814
return false;
815-
if (!CheckWeak(S, OpPC, Ptr.block()))
816-
return false;
815+
return CheckWeak(S, OpPC, Ptr.block());
817816
}
818817

819818
if (!CheckConstant(S, OpPC, Ptr))

0 commit comments

Comments
 (0)