[clang] 31dc908 - [clang] Use isCompoundAssignmentOp to simplify the code, NFC.

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 7 00:52:32 PDT 2020


Author: Haojian Wu
Date: 2020-10-07T09:50:43+02:00
New Revision: 31dc90801746e12d6ae1f967f455cf43a5bbb039

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

LOG: [clang] Use isCompoundAssignmentOp to simplify the code, NFC.

Added: 
    

Modified: 
    clang/lib/Sema/SemaOverload.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 4696ed56dc71..43b2ad48de1f 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -13345,14 +13345,14 @@ ExprResult Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
     if (Fns.empty()) {
       // If there are no functions to store, just build a dependent
       // BinaryOperator or CompoundAssignment.
-      if (Opc <= BO_Assign || Opc > BO_OrAssign)
-        return BinaryOperator::Create(
-            Context, Args[0], Args[1], Opc, Context.DependentTy, VK_RValue,
-            OK_Ordinary, OpLoc, CurFPFeatureOverrides());
-      return CompoundAssignOperator::Create(
-          Context, Args[0], Args[1], Opc, Context.DependentTy, VK_LValue,
-          OK_Ordinary, OpLoc, CurFPFeatureOverrides(), Context.DependentTy,
-          Context.DependentTy);
+      if (BinaryOperator::isCompoundAssignmentOp(Opc))
+        return CompoundAssignOperator::Create(
+            Context, Args[0], Args[1], Opc, Context.DependentTy, VK_LValue,
+            OK_Ordinary, OpLoc, CurFPFeatureOverrides(), Context.DependentTy,
+            Context.DependentTy);
+      return BinaryOperator::Create(Context, Args[0], Args[1], Opc,
+                                    Context.DependentTy, VK_RValue, OK_Ordinary,
+                                    OpLoc, CurFPFeatureOverrides());
     }
 
     // FIXME: save results of ADL from here?


        


More information about the cfe-commits mailing list