rsmith added inline comments.

================
Comment at: lib/CodeGen/CGExpr.cpp:1429
+/// for instance if a block or lambda or a member of a local class uses a
+/// const int variable or constexpr variable from an enclosing function.
 CodeGenFunction::ConstantEmission
----------------
rjmccall wrote:
> Isn't the old comment correct here?  This is mandatory because of the 
> enclosing-local-scope issues; that might be an "optimization" in the 
> language, but it's not an optimization at the IRGen level because Sema 
> literally is forcing us to do it. 
In the absence of this code, we'd emit the variable as a global constant from 
`EmitDeclRefLValue` in the enclosing-local-scope case (as we now do in the 
more-complex cases), so this should never be necessary for correct code 
generation any more.


================
Comment at: lib/Sema/SemaExpr.cpp:15808
+namespace {
+// Helper to copy the template arguments from a DeclRefExpr or MemberExpr.
+class CopiedTemplateArgs {
----------------
rjmccall wrote:
> This is really cute; I might steal this idea.  That said, it's probably worth 
> explaining the lifetime mechanics here so that non-experts can understand how 
> this works.
Done. I also added a `[[clang::lifetimebound]]` attribute so we'll get a 
warning if this is misused.


Repository:
  rC Clang

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

https://reviews.llvm.org/D63157



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D63157: C... Richard Smith - zygoloid via Phabricator via cfe-commits
    • [PATCH] D631... John McCall via Phabricator via cfe-commits
    • [PATCH] D631... Richard Smith - zygoloid via Phabricator via cfe-commits
    • [PATCH] D631... Richard Smith - zygoloid via Phabricator via cfe-commits
    • [PATCH] D631... John McCall via Phabricator via cfe-commits
    • [PATCH] D631... Richard Smith - zygoloid via Phabricator via cfe-commits

Reply via email to