================
@@ -5223,6 +5230,24 @@ enum EvalStmtResult {
 };
 }
 
+static bool EvaluateInitForDeclOfReferenceType(EvalInfo &Info,
+                                               const ValueDecl *D,
+                                               const Expr *Init, LValue 
&Result,
+                                               APValue &Val) {
+  assert(Init->isGLValue() && D->getType()->isReferenceType());
+  if (!EvaluateLValue(Init, Result, Info))
+    return false;
+  CompleteObject Obj = findCompleteObject(
+      Info, Init, AK_ReferenceInitialization, Result, Init->getType());
+  if (!Result.Designator.Invalid && Result.Designator.isOnePastTheEnd()) {
+    Info.FFDiag(Init, diag::note_constexpr_access_past_end)
+        << AK_ReferenceInitialization;
+    return false;
+  }
+  Result.moveInto(Val);
+  return !!Obj;
----------------
shafik wrote:

I feel like this line could use a comment explaining the semantics. I really 
like that you split this out into a function, it makes it much more readable. 
OTOH you could just comment the whole function on top explain the semantics of 
the return value.

https://github.com/llvm/llvm-project/pull/143667
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to