summaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2005-06-02 09:34:38 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2005-06-02 09:34:38 +0000
commita18487bb4c092d0e3a09481186aafb87290f6e72 (patch)
tree2e82b949e5fbc2faf1a0d693b2123f86aac63f7b /gcc/cp
parent8a61cf3025d7cd6718c0a21ba4c6a689ae0fb53c (diff)
downloadgcc-a18487bb4c092d0e3a09481186aafb87290f6e72.tar.gz
* decl.c (start_decl): Simplify specialization handling. Remove
unneeded CLASSTYPE_TEMPLATE_INSTANTIATION check. * mangle.c (discriminator_for_local_entity): Use VEC_index. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@100488 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/decl.c22
-rw-r--r--gcc/cp/mangle.c17
3 files changed, 26 insertions, 17 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 1314bcfbc99..7524d5e557b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2005-06-02 Nathan Sidwell <nathan@codesourcery.com>
+ * decl.c (start_decl): Simplify specialization handling. Remove
+ unneeded CLASSTYPE_TEMPLATE_INSTANTIATION check.
+ * mangle.c (discriminator_for_local_entity): Use VEC_index.
+
PR c++/20350
* decl.c (duplicate_decls): Copy all of DECL_USE_TEMPLATE.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 83bd6fc9324..83c67198dc7 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -3716,22 +3716,22 @@ start_decl (const cp_declarator *declarator,
/* cp_finish_decl sets DECL_EXTERNAL if DECL_IN_AGGR_P is set. */
DECL_IN_AGGR_P (decl) = 0;
- if ((DECL_LANG_SPECIFIC (decl) && DECL_USE_TEMPLATE (decl))
- || CLASSTYPE_TEMPLATE_INSTANTIATION (context))
- {
- /* Do not mark DECL as an explicit specialization if it was
- not already marked as an instantiation; a declaration
- should never be marked as a specialization unless we know
- what template is being specialized. */
- if (DECL_LANG_SPECIFIC (decl) && DECL_USE_TEMPLATE (decl))
- SET_DECL_TEMPLATE_SPECIALIZATION (decl);
+ /* Do not mark DECL as an explicit specialization if it was not
+ already marked as an instantiation; a declaration should
+ never be marked as a specialization unless we know what
+ template is being specialized. */
+ if (DECL_LANG_SPECIFIC (decl) && DECL_USE_TEMPLATE (decl))
+ {
+ SET_DECL_TEMPLATE_SPECIALIZATION (decl);
+
/* [temp.expl.spec] An explicit specialization of a static data
member of a template is a definition if the declaration
includes an initializer; otherwise, it is a declaration.
-
+
We check for processing_specialization so this only applies
to the new specialization syntax. */
- if (DECL_INITIAL (decl) == NULL_TREE && processing_specialization)
+ if (!DECL_INITIAL (decl)
+ && processing_specialization)
DECL_EXTERNAL (decl) = 1;
}
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index a2fefd0c238..8c276b586ae 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -1426,8 +1426,6 @@ write_special_name_destructor (const tree dtor)
static int
discriminator_for_local_entity (tree entity)
{
- tree *type;
-
/* Assume this is the only local entity with this name. */
int discriminator = 0;
@@ -1435,12 +1433,19 @@ discriminator_for_local_entity (tree entity)
discriminator = DECL_DISCRIMINATOR (entity);
else if (TREE_CODE (entity) == TYPE_DECL)
{
+ int ix;
+
/* Scan the list of local classes. */
entity = TREE_TYPE (entity);
- for (type = VEC_address (tree, local_classes); *type != entity; ++type)
- if (TYPE_IDENTIFIER (*type) == TYPE_IDENTIFIER (entity)
- && TYPE_CONTEXT (*type) == TYPE_CONTEXT (entity))
- ++discriminator;
+ for (ix = 0; ; ix++)
+ {
+ tree type = VEC_index (tree, local_classes, ix);
+ if (type == entity)
+ break;
+ if (TYPE_IDENTIFIER (type) == TYPE_IDENTIFIER (entity)
+ && TYPE_CONTEXT (type) == TYPE_CONTEXT (entity))
+ ++discriminator;
+ }
}
return discriminator;