mizvekov added inline comments.

================
Comment at: clang/lib/Sema/Sema.cpp:460-462
+        Scope S(TUScope, Scope::DeclScope, getDiagnostics());
+        PushDeclContext(&S, DC);
+        PushOnScopeChains(ND, &S);
----------------
aaron.ballman wrote:
> Is it valid to use a local variable as a `Scope` object? I would assume that 
> scope goes away at the end of this compound statement? I didn't spot other 
> cases where we did this -- usually we call `Parser::EnterScope()` which 
> allocates a new `Scope` that `Sema` then uses.
I don't see anything problematic about allocating it on the stack like this, 
implementation-wise.

I thought it would be a bit counter-intuitive to use parser functions here, 
since these declarations are entirely synthetic.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136886

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to