[clang] c319694 - [clang][Interp][NFC] Compare std::optional variables directly

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 27 02:37:18 PDT 2023


Author: Timm Bäder
Date: 2023-06-27T11:36:42+02:00
New Revision: c3196947312e530960fde1b8849a4a848a5095f3

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

LOG: [clang][Interp][NFC] Compare std::optional variables directly

We can do that and we already checked that they aren't nullopt before.

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 8558ba0ba1ee7..86200f9ad0831 100644
--- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp
+++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
@@ -230,7 +230,7 @@ bool ByteCodeExprGen<Emitter>::VisitBinaryOperator(const BinaryOperator *BO) {
 
   // Pointer arithmetic special case.
   if (BO->getOpcode() == BO_Add || BO->getOpcode() == BO_Sub) {
-    if (*T == PT_Ptr || (*LT == PT_Ptr && *RT == PT_Ptr))
+    if (T == PT_Ptr || (LT == PT_Ptr && RT == PT_Ptr))
       return this->VisitPointerArithBinOp(BO);
   }
 


        


More information about the cfe-commits mailing list