On 9/10/20 12:58 PM, Marek Polacek via Gcc-patches wrote:
On Thu, Sep 10, 2020 at 12:39:36PM -0400, Nathan Sidwell wrote:

We need to record whether template function-scope static decls are
constinit.  That's currently held on the var's TEMPLATE_INFO data.
But I want to get rid of such decl's template header as they're not
really templates, and they're never instantiated separately from their
containing function's definition.  (Just like auto vars, which don't
get them for instance).

This patch moves the flag into a spare decl_lang_flag.

         gcc/cp/
         * cp-tree.h (TINFO_VAR_DECLARED_CONSTINIT): Replace with ...
         (DECL_DECLARED_CONSTINIT_P): ... this.
         * decl.c (start_decl): No need to retrofit_lang_decl for constinit
         flag.
         (cp_finish_decl): Use DECL_DECLARED_CONSTINIT_P.
         * pt.c (tsubst_decl): No need to handle constinit flag
         propagation.
         (tsubst_expr): Or here.

Is there any need for LOOKUP_CONSTINIT anymore, if we can simply check
DECL_DECLARED_CONSTINIT_P?  (Not saying you need to clean that up.)

That'd be nice.  Those LOOKUP_$FOO flags are getting less and less lookupy!


My first constinit patch had DECL_DECLARED_CONSTINIT_P, but then I changed
it:
https://gcc.gnu.org/pipermail/gcc-patches/2019-August/528665.html

Marek



--
Nathan Sidwell

Reply via email to