[PATCH] D151587: [clang][ConstantEmitter] have tryEmitPrivate[ForVarInit] try ConstExprEmitter fast-path first

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 9 09:39:05 PDT 2023


efriedma added inline comments.


================
Comment at: clang/lib/CodeGen/CGExprConstant.cpp:1279
+      if (isa<MaterializeTemporaryExpr>(E))
+        return nullptr;
+
----------------
This needs a comment explaining why we're bailing out here.


================
Comment at: clang/lib/CodeGen/CGExprConstant.cpp:1664
 
   // FIXME: Implement C++11 [basic.start.init]p2: if the initializer of a
   // reference is a constant expression, and the reference binds to a temporary,
----------------
You can probably delete this FIXME comment.


================
Comment at: clang/lib/CodeGen/CGExprConstant.cpp:1670
   // desired value of the referee.
-  if (destType->isReferenceType())
-    return nullptr;
+  if (!destType->isLValueReferenceType()) {
+    QualType nonMemoryDestType = getNonMemoryType(CGM, destType);
----------------
Why are you changing this to "isLValueReferenceType"?  I think rvalue references need to be handled basically the same way as lvalue references.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151587



More information about the cfe-commits mailing list