aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/cp/decl2.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/cp/decl2.c')
-rw-r--r--gcc-4.9/gcc/cp/decl2.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/cp/decl2.c b/gcc-4.9/gcc/cp/decl2.c
index 3088918cd..4fc03e912 100644
--- a/gcc-4.9/gcc/cp/decl2.c
+++ b/gcc-4.9/gcc/cp/decl2.c
@@ -1931,6 +1931,11 @@ decl_needed_p (tree decl)
if (flag_keep_inline_dllexport
&& lookup_attribute ("dllexport", DECL_ATTRIBUTES (decl)))
return true;
+ /* Virtual functions might be needed for devirtualization. */
+ if (flag_devirtualize
+ && TREE_CODE (decl) == FUNCTION_DECL
+ && DECL_VIRTUAL_P (decl))
+ return true;
/* Otherwise, DECL does not need to be emitted -- yet. A subsequent
reference to DECL might cause it to be emitted later. */
return false;