[PATCH] D84226: [AST][RecoveryExpr] Part1: Support dependent binary operator in C for error recovery.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 18 03:50:59 PDT 2020


sammccall added inline comments.


================
Comment at: clang/lib/Sema/SemaExpr.cpp:14255
+  if (Opc <= BO_Assign || Opc > BO_OrAssign)
+    return BinaryOperator::Create(Context, LHS, RHS, Opc, Context.DependentTy,
+                                  VK_RValue, OK_Ordinary, OpLoc,
----------------
I think we can do better on types here: for several binary operators the type is boolean in C regardless of operands. (except for vector types I think, but those might be rare enough to ignore in recovery)


================
Comment at: clang/lib/Sema/SemaExpr.cpp:14258
+                                  CurFPFeatureOverrides());
+  return CompoundAssignOperator::Create(
+      Context, LHS, RHS, Opc, Context.DependentTy, VK_LValue, OK_Ordinary,
----------------
In C the result type is the unqualified type of the LHS


================
Comment at: clang/lib/Sema/SemaExpr.cpp:14260
+      Context, LHS, RHS, Opc, Context.DependentTy, VK_LValue, OK_Ordinary,
+      OpLoc, CurFPFeatureOverrides(), Context.DependentTy, Context.DependentTy);
+}
----------------
I don't think we need to override the computation types, we can just leave them null?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84226/new/

https://reviews.llvm.org/D84226



More information about the cfe-commits mailing list