Fix a regression introduced in r180971. Only applicable to LIPO. For google branch only. Tested with internal benchmark suite.
Thanks, -Rong 2011-11-16 Rong Xu <x...@google.com> * gcc/dwarf2out.c: use TYPE_CONTEXT to get the context for types. Index: gcc/dwarf2out.c =================================================================== --- gcc/dwarf2out.c (revision 181431) +++ gcc/dwarf2out.c (working copy) @@ -19764,10 +19764,6 @@ { struct cgraph_node *node; - orig_decl = DECL_ORIGIN (decl_context); - while (orig_decl != DECL_ORIGIN (orig_decl)) - orig_decl = DECL_ORIGIN (orig_decl); - /* Refer to cgraph_mark_functions_to_output() in cgraphunit.c, if cgraph_is_aux_decl_external() is true, this function will not be output in LIPO mode. */ @@ -19777,6 +19773,16 @@ cgraph_is_aux_decl_external (node)) return; + if (TREE_CODE_CLASS (TREE_CODE (decl_context)) == tcc_type) + { + decl_context = TYPE_CONTEXT (decl_context); + continue; + } + + orig_decl = DECL_ORIGIN (decl_context); + while (orig_decl != DECL_ORIGIN (orig_decl)) + orig_decl = DECL_ORIGIN (orig_decl); + decl_context = DECL_CONTEXT (orig_decl); } } -- This patch is available for review at http://codereview.appspot.com/5401045