aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2004-12-20 02:23:49 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2004-12-20 02:23:49 +0000
commit5e2f4cd242aaa15c3b594434764660e1e96d4065 (patch)
treeb3695fa617f49759e8841d34d68aab1bc7d83d5f /gcc
parent57829bc4f05c1087e005bc68adca4a0236f7e115 (diff)
downloadgcc-5e2f4cd242aaa15c3b594434764660e1e96d4065.zip
gcc-5e2f4cd242aaa15c3b594434764660e1e96d4065.tar.gz
gcc-5e2f4cd242aaa15c3b594434764660e1e96d4065.tar.bz2
cp-tree.h (note_decl_for_pch): New function.
* cp-tree.h (note_decl_for_pch): New function. * class.c (build_clone): Call note_decl_for_pch. * semantics.c (finish_member_declaration): Likewise. (note_decl_for_pch): New function. From-SVN: r92402
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/class.c2
-rw-r--r--gcc/cp/cp-tree.h1
-rw-r--r--gcc/cp/semantics.c34
4 files changed, 44 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 2007959..57affb0 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2004-12-19 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.h (note_decl_for_pch): New function.
+ * class.c (build_clone): Call note_decl_for_pch.
+ * semantics.c (finish_member_declaration): Likewise.
+ (note_decl_for_pch): New function.
+
2004-12-17 Steven Bosscher <stevenb@suse.de>
* init.c (build_zero_init): max_index is the number of
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 688744c..c7b0c68 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -3786,6 +3786,8 @@ build_clone (tree fn, tree name)
DECL_TEMPLATE_INFO (result) = copy_node (DECL_TEMPLATE_INFO (result));
DECL_TI_TEMPLATE (result) = clone;
}
+ else if (pch_file)
+ note_decl_for_pch (clone);
return clone;
}
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 54fade9..fdc828d 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -4188,6 +4188,7 @@ extern void check_accessibility_of_qualified_id (tree, tree, tree);
extern tree finish_qualified_id_expr (tree, tree, bool, bool);
extern void simplify_aggr_init_expr (tree *);
extern void finalize_nrv (tree *, tree, tree);
+extern void note_decl_for_pch (tree);
/* in tree.c */
extern void lang_check_failed (const char *, int,
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 956bf04..19c6d5d 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -2226,6 +2226,40 @@ finish_member_declaration (tree decl)
maybe_add_class_template_decl_list (current_class_type, decl,
/*friend_p=*/0);
}
+
+ if (pch_file)
+ note_decl_for_pch (decl);
+}
+
+/* DECL has been declared while we are building a PCH file. Perform
+ actions that we might normally undertake lazily, but which can be
+ performed now so that they do not have to be performed in
+ translation units which include the PCH file. */
+
+void
+note_decl_for_pch (tree decl)
+{
+ gcc_assert (pch_file);
+
+ /* A non-template inline function with external linkage will always
+ be COMDAT. As we must eventually determine the linkage of all
+ functions, and as that causes writes to the data mapped in from
+ the PCH file, it's advantageous to mark the functions at this
+ point. */
+ if (TREE_CODE (decl) == FUNCTION_DECL
+ && TREE_PUBLIC (decl)
+ && DECL_DECLARED_INLINE_P (decl)
+ && !DECL_IMPLICIT_INSTANTIATION (decl))
+ {
+ comdat_linkage (decl);
+ DECL_INTERFACE_KNOWN (decl) = 1;
+ }
+
+ /* There's a good chance that we'll have to mangle names at some
+ point, even if only for emission in debugging information. */
+ if (TREE_CODE (decl) == VAR_DECL
+ || TREE_CODE (decl) == FUNCTION_DECL)
+ mangle_decl (decl);
}
/* Finish processing a complete template declaration. The PARMS are