c++: DECL_BUILTIN_P for builtins

Nathan Sidwell nathan@acm.org
Fri Sep 25 13:58:40 GMT 2020


We currently detect builtin decls via DECL_ARTIFICIAL &&
!DECL_HIDDEN_FUNCTION_P, which, besides being clunky, is a problem as
hiddenness is a property of the symbol table -- not the decl being
hidden.  This adds DECL_BUILTIN_P, which just looks at the
SOURCE_LOCATION -- we have a magic one for builtins.

One of the consequential changes is to make function-scope omp udrs
have function context (needed because otherwise duplicate-decls thinks
the types don't match at the point we check).  This is also morally
better, because that's what they are -- nested functions, stop lying.

(That's actually my plan for all DECL_LOCAL_DECL_P decls, as they are
distinct decls to the namespace-scope decl they alias.)

         gcc/cp/
         * cp-tree.h (DECL_BUILTIN_P): New.
         * decl.c (duplicate_decls): Use it.  Do not treat omp-udr as a
         builtin.
         * name-lookup.c (anticipated_builtin): Use it.
         (set_decl_context_in_fn): Function-scope OMP UDRs have function 
context.
         (do_nonmember_using_decl): Use DECL_BUILTIN_P.
         * parser.c (cp_parser_omp_declare_reduction): Function-scope OMP
         UDRs have function context.  Assert we never find a valid 
duplicate.
         * pt.c (tsubst_expr): Function-scope OMP UDRs have function 
context.
         libcc1/
         * libcp1plugin.cc (supplement_binding): Use DECL_BULTIN_P.

pushing to trunk

nathan

-- 
Nathan Sidwell
-------------- next part --------------
A non-text attachment was scrubbed...
Name: decl-builtin.diff
Type: text/x-patch
Size: 6579 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20200925/658801df/attachment-0001.bin>


More information about the Gcc-patches mailing list