[PATCH] D136886: [clang] ASTImporter: Fix importing of va_list types and declarations

Matheus Izvekov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 31 05:58:26 PDT 2022


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



More information about the cfe-commits mailing list