From 4d1d8d6af37778f9d896285ca5185d07ca2c3450 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 26 Aug 2016 10:59:50 +0000 Subject: [PATCH] mangle.c (java_mangle_decl): Re-sync with lhd_set_decl_assembler_name. 2016-08-26 Richard Biener java/ * mangle.c (java_mangle_decl): Re-sync with lhd_set_decl_assembler_name. From-SVN: r239774 --- gcc/java/ChangeLog | 5 +++++ gcc/java/mangle.c | 16 ++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index ba2ab906312..74c5be8cc5d 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,8 @@ +2016-08-26 Richard Biener + + java/ + * mangle.c (java_mangle_decl): Re-sync with lhd_set_decl_assembler_name. + 2016-08-12 Marek Polacek PR c/7652 diff --git a/gcc/java/mangle.c b/gcc/java/mangle.c index 6c33396c342..d61fc028ae0 100644 --- a/gcc/java/mangle.c +++ b/gcc/java/mangle.c @@ -74,15 +74,23 @@ static GTY(()) tree atms; void java_mangle_decl (tree decl) { - /* A copy of the check from the beginning of lhd_set_decl_assembler_name. - Only FUNCTION_DECLs and VAR_DECLs for variables with static storage - duration need a real DECL_ASSEMBLER_NAME. */ + /* A copy of the check from the beginning of lhd_set_decl_assembler_name. */ + + /* set_decl_assembler_name may be called on TYPE_DECL to record ODR + name for C++ types. By default types have no ODR names. */ + if (TREE_CODE (decl) == TYPE_DECL) + return; + + /* The language-independent code should never use the + DECL_ASSEMBLER_NAME for lots of DECLs. Only FUNCTION_DECLs and + VAR_DECLs for variables with static storage duration need a real + DECL_ASSEMBLER_NAME. */ gcc_assert (TREE_CODE (decl) == FUNCTION_DECL || (TREE_CODE (decl) == VAR_DECL && (TREE_STATIC (decl) || DECL_EXTERNAL (decl) || TREE_PUBLIC (decl)))); - + /* Mangling only applies to class members. */ if (DECL_CONTEXT (decl) && TYPE_P (DECL_CONTEXT (decl))) { -- 2.30.2