diff options
Diffstat (limited to 'gcc/cp/decl2.c')
-rw-r--r-- | gcc/cp/decl2.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index de28cb712c3..63583a8dc6a 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -1975,6 +1975,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; |