On Mon, 2 Mar 2020 16:48:26 -0500 David Malcolm <dmalc...@redhat.com> wrote:
> +static inline bool > +is_std_function_p (const_tree fndecl) > +{ > + tree name_decl = DECL_NAME (fndecl); > + if (!name_decl) > + return false; > + if (!DECL_CONTEXT (fndecl)) > + return false; > + if (TREE_CODE (DECL_CONTEXT (fndecl)) != NAMESPACE_DECL) > + return false; > + tree ns = DECL_CONTEXT (fndecl); > + if (!(DECL_CONTEXT (ns) == NULL_TREE > + || TREE_CODE (DECL_CONTEXT (ns)) == TRANSLATION_UNIT_DECL)) > + return false; > + if (!DECL_NAME (ns)) > + return false; > + return id_equal ("std", DECL_NAME (ns)); > +} Sounds a bit elaborate, doesn't? I hope this is optimized to static inline bool is_std_function_p (const_tree fndecl) { tree name_decl = DECL_NAME (fndecl); if (!name_decl) return false; tree ns = DECL_CONTEXT (fndecl); if (!ns) return false; if (TREE_CODE (ns) != NAMESPACE_DECL) return false; if (!(DECL_CONTEXT (ns) == NULL_TREE || TREE_CODE (DECL_CONTEXT (ns)) == TRANSLATION_UNIT_DECL)) return false; if (!DECL_NAME (ns)) return false; return id_equal ("std", DECL_NAME (ns)); } isn't "std" spelled out std_identifier() and is an identifier, i.e. return DECL_NAME (ns) == std_identifier; ? thanks,