[clang] f06e07b - [clang][Interp][NFC] Check pointer compound assign operators for errors

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 16 03:30:35 PST 2024


Author: Timm Bäder
Date: 2024-02-16T12:30:24+01:00
New Revision: f06e07be9a41978e39fdf22f6174194cf8382047

URL: https://github.com/llvm/llvm-project/commit/f06e07be9a41978e39fdf22f6174194cf8382047
DIFF: https://github.com/llvm/llvm-project/commit/f06e07be9a41978e39fdf22f6174194cf8382047.diff

LOG: [clang][Interp][NFC] Check pointer compound assign operators for errors

This needs to be done but we didn't use to do it.

Added: 
    

Modified: 
    clang/lib/AST/Interp/ByteCodeExprGen.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
index e4b48c4e946f13..a27a0cb2094eae 100644
--- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp
+++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
@@ -1446,10 +1446,13 @@ bool ByteCodeExprGen<Emitter>::VisitPointerCompoundAssignOperator(
   if (!visit(RHS))
     return false;
 
-  if (Op == BO_AddAssign)
-    this->emitAddOffset(*RT, E);
-  else
-    this->emitSubOffset(*RT, E);
+  if (Op == BO_AddAssign) {
+    if (!this->emitAddOffset(*RT, E))
+      return false;
+  } else {
+    if (!this->emitSubOffset(*RT, E))
+      return false;
+  }
 
   if (DiscardResult)
     return this->emitStorePopPtr(E);


        


More information about the cfe-commits mailing list