aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/optimize.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2000-04-06 03:12:19 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2000-04-06 03:12:19 +0000
commit16d53b6439684014a67dd9086e8e75e26f6ee4ec (patch)
tree40b36e31ab940371efa53fd3d29c1160f917bf91 /gcc/cp/optimize.c
parent256172c40c392ccf732d008b096461a6e4923fec (diff)
downloadgcc-16d53b6439684014a67dd9086e8e75e26f6ee4ec.zip
gcc-16d53b6439684014a67dd9086e8e75e26f6ee4ec.tar.gz
gcc-16d53b6439684014a67dd9086e8e75e26f6ee4ec.tar.bz2
cp-tree.h (instantiate_decl): Change prototype.
* cp-tree.h (instantiate_decl): Change prototype. * decl2.c (mark_used): Adjust call. * optimize.c (inlinable_function_p): Adjust handling of templates. * pt.c (do_decl_instantiation): Adjust call to instantiate_decl. (do_type_instantiation): Likewise. (instantiate_decl): Defer more templates. (instantiate_pending_templates): Adjust logic to handle inline friend functions. From-SVN: r32959
Diffstat (limited to 'gcc/cp/optimize.c')
-rw-r--r--gcc/cp/optimize.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c
index 5ba9ea7..63ec81a 100644
--- a/gcc/cp/optimize.c
+++ b/gcc/cp/optimize.c
@@ -463,10 +463,6 @@ inlinable_function_p (fn, id)
it. */
else if (!DECL_INLINE (fn))
;
- /* If we don't have the function body available, we can't inline
- it. */
- else if (!DECL_SAVED_TREE (fn))
- ;
/* We can't inline varargs functions. */
else if (varargs_function_p (fn))
;
@@ -481,6 +477,21 @@ inlinable_function_p (fn, id)
/* Squirrel away the result so that we don't have to check again. */
DECL_UNINLINABLE (fn) = !inlinable;
+ /* We can inline a template instantiation only if it's fully
+ instantiated. */
+ if (inlinable
+ && DECL_TEMPLATE_INFO (fn)
+ && TI_PENDING_TEMPLATE_FLAG (DECL_TEMPLATE_INFO (fn)))
+ {
+ fn = instantiate_decl (fn, /*defer_ok=*/0);
+ inlinable = !TI_PENDING_TEMPLATE_FLAG (DECL_TEMPLATE_INFO (fn));
+ }
+
+ /* If we don't have the function body available, we can't inline
+ it. */
+ if (!DECL_SAVED_TREE (fn))
+ inlinable = 0;
+
/* Don't do recursive inlining, either. We don't record this in
DECL_UNLINABLE; we may be able to inline this function later. */
if (inlinable)
@@ -492,16 +503,6 @@ inlinable_function_p (fn, id)
inlinable = 0;
}
- /* We can inline a template instantiation only if it's fully
- instantiated. */
- if (inlinable
- && DECL_TEMPLATE_INFO (fn)
- && TI_PENDING_TEMPLATE_FLAG (DECL_TEMPLATE_INFO (fn)))
- {
- fn = instantiate_decl (fn);
- inlinable = !TI_PENDING_TEMPLATE_FLAG (DECL_TEMPLATE_INFO (fn));
- }
-
/* Return the result. */
return inlinable;
}