c++: Exported using decls
With modules we need to record whethe a (namespace-scope) using decl is exporting the named entities. Record this on the OVERLOAD marking the used decl. gcc/cp/ * cp-tree.h (OVL_EXPORT): New. (class ovl_iterator): Add get_using, exporting_p. * tree.c (ovl_insert): Extend using_or_hidden meaning to include an exported using.
This commit is contained in:
parent
f7aeb823d9
commit
a3f7a6957a
2 changed files with 25 additions and 7 deletions
|
@ -488,10 +488,9 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX];
|
|||
CALL_EXPR_ORDERED_ARGS (in CALL_EXPR, AGGR_INIT_EXPR)
|
||||
DECLTYPE_FOR_REF_CAPTURE (in DECLTYPE_TYPE)
|
||||
CONSTRUCTOR_C99_COMPOUND_LITERAL (in CONSTRUCTOR)
|
||||
DECL_MODULE_EXPORT_P (in _DECL)
|
||||
OVL_NESTED_P (in OVERLOAD)
|
||||
LAMBDA_EXPR_INSTANTIATED (in LAMBDA_EXPR)
|
||||
Reserved for DECL_MODULE_EXPORT (in DECL_)
|
||||
DECL_MODULE_EXPORT_P (in _DECL)
|
||||
4: IDENTIFIER_MARKED (IDENTIFIER_NODEs)
|
||||
TREE_HAS_CONSTRUCTOR (in INDIRECT_REF, SAVE_EXPR, CONSTRUCTOR,
|
||||
CALL_EXPR, or FIELD_DECL).
|
||||
|
@ -503,6 +502,7 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX];
|
|||
FUNCTION_RVALUE_QUALIFIED (in FUNCTION_TYPE, METHOD_TYPE)
|
||||
CALL_EXPR_REVERSE_ARGS (in CALL_EXPR, AGGR_INIT_EXPR)
|
||||
CONSTRUCTOR_PLACEHOLDER_BOUNDARY (in CONSTRUCTOR)
|
||||
OVL_EXPORT_P (in OVERLOAD)
|
||||
6: TYPE_MARKED_P (in _TYPE)
|
||||
DECL_NONTRIVIALLY_INITIALIZED_P (in VAR_DECL)
|
||||
RANGE_FOR_IVDEP (in RANGE_FOR_STMT)
|
||||
|
@ -780,6 +780,8 @@ typedef struct ptrmem_cst * ptrmem_cst_t;
|
|||
#define OVL_NESTED_P(NODE) TREE_LANG_FLAG_3 (OVERLOAD_CHECK (NODE))
|
||||
/* If set, this overload was constructed during lookup. */
|
||||
#define OVL_LOOKUP_P(NODE) TREE_LANG_FLAG_4 (OVERLOAD_CHECK (NODE))
|
||||
/* If set, this OVL_USING_P overload is exported. */
|
||||
#define OVL_EXPORT_P(NODE) TREE_LANG_FLAG_5 (OVERLOAD_CHECK (NODE))
|
||||
|
||||
/* The first decl of an overload. */
|
||||
#define OVL_FIRST(NODE) ovl_first (NODE)
|
||||
|
@ -839,6 +841,11 @@ class ovl_iterator {
|
|||
|
||||
return fn;
|
||||
}
|
||||
tree get_using () const
|
||||
{
|
||||
gcc_checking_assert (using_p ());
|
||||
return ovl;
|
||||
}
|
||||
|
||||
public:
|
||||
/* Whether this overload was introduced by a using decl. */
|
||||
|
@ -847,6 +854,12 @@ class ovl_iterator {
|
|||
return (TREE_CODE (ovl) == USING_DECL
|
||||
|| (TREE_CODE (ovl) == OVERLOAD && OVL_USING_P (ovl)));
|
||||
}
|
||||
/* Whether this using is being exported. */
|
||||
bool exporting_p () const
|
||||
{
|
||||
return OVL_EXPORT_P (get_using ());
|
||||
}
|
||||
|
||||
bool hidden_p () const
|
||||
{
|
||||
return TREE_CODE (ovl) == OVERLOAD && OVL_HIDDEN_P (ovl);
|
||||
|
|
|
@ -2272,10 +2272,11 @@ ovl_make (tree fn, tree next)
|
|||
return result;
|
||||
}
|
||||
|
||||
/* Add FN to the (potentially NULL) overload set OVL. USING_OR_HIDDEN
|
||||
is > 0, if FN is via a using declaration. USING_OR_HIDDEN is < 0,
|
||||
if FN is hidden. (A decl cannot be both using and hidden.) We
|
||||
keep the hidden decls first, but remaining ones are unordered. */
|
||||
/* Add FN to the (potentially NULL) overload set OVL. USING_OR_HIDDEN is >
|
||||
zero if this is a using-decl. It is > 1 if we're exporting the
|
||||
using decl. USING_OR_HIDDEN is < 0, if FN is hidden. (A decl
|
||||
cannot be both using and hidden.) We keep the hidden decls first,
|
||||
but remaining ones are unordered. */
|
||||
|
||||
tree
|
||||
ovl_insert (tree fn, tree maybe_ovl, int using_or_hidden)
|
||||
|
@ -2299,7 +2300,11 @@ ovl_insert (tree fn, tree maybe_ovl, int using_or_hidden)
|
|||
if (using_or_hidden < 0)
|
||||
OVL_HIDDEN_P (maybe_ovl) = true;
|
||||
if (using_or_hidden > 0)
|
||||
OVL_DEDUP_P (maybe_ovl) = OVL_USING_P (maybe_ovl) = true;
|
||||
{
|
||||
OVL_DEDUP_P (maybe_ovl) = OVL_USING_P (maybe_ovl) = true;
|
||||
if (using_or_hidden > 1)
|
||||
OVL_EXPORT_P (maybe_ovl) = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
maybe_ovl = fn;
|
||||
|
|
Loading…
Add table
Reference in a new issue