Commit Graph

153 Commits

Author SHA1 Message Date
Gary Benson 861c349582 cp-demangle.c (struct d_component_stack): New structure.
libiberty/
2014-05-08  Gary Benson  <gbenson@redhat.com>

	* cp-demangle.c (struct d_component_stack): New structure.
	(struct d_print_info): New field component_stack.
	(d_print_init): Initialize the above.
	(d_print_comp_inner): Renamed from d_print_comp.
	Do not restore template stack if it would cause a loop.
	(d_print_comp): New function.
	* testsuite/demangle-expected: New test cases.

From-SVN: r210205
2014-05-08 09:13:44 +00:00
Thomas Schwinge e191f50260 Avoid "'dc' may be uninitialized" warning.
libiberty/
	* cp-demangle.c (d_demangle_callback): Put an abort call in place,
	to help the compiler.

From-SVN: r207200
2014-01-28 20:06:44 +01:00
Gary Benson 0a15a50e83 cp-demangle.c (struct d_print_info): New fields next_saved_scope...
libiberty/
2014-01-06  Gary Benson  <gbenson@redhat.com>

	* cp-demangle.c (struct d_print_info): New fields
	next_saved_scope, copy_templates, next_copy_template and
	num_copy_templates.
	(d_count_templates): New function.
	(d_print_init): New parameter "dc".
	Estimate numbers of templates and scopes required.
	(d_print_free): Removed function.
	(cplus_demangle_print_callback): Allocate stack for
	templates and scopes.  Removed call to d_print_free.
	(d_copy_templates): Removed function.
	(d_save_scope): New function.
	(d_get_saved_scope): Likewise.
	(d_print_comp): Replace state saving/restoring code with
	calls to d_save_scope and d_get_saved_scope.

From-SVN: r206362
2014-01-06 14:14:21 +00:00
Jason Merrill 1f26ac8748 re PR c++/41090 (Using static label reference in c++ class constructor produces wrong code)
PR c++/41090
	Add -fdeclone-ctor-dtor.
gcc/cp/
	* optimize.c (can_alias_cdtor, populate_clone_array): Split out
	from maybe_clone_body.
	(maybe_thunk_body): New function.
	(maybe_clone_body): Call it.
	* mangle.c (write_mangled_name): Remove code to suppress
	writing of mangled name for cloned constructor or destructor.
	(write_special_name_constructor): Handle decloned constructor.
	(write_special_name_destructor): Handle decloned destructor.
	* method.c (trivial_fn_p): Handle decloning.
	* semantics.c (expand_or_defer_fn_1): Clone after setting linkage.
gcc/c-family/
	* c.opt: Add -fdeclone-ctor-dtor.
	* c-opts.c (c_common_post_options): Default to on iff -Os.
gcc/
	* cgraph.h (struct cgraph_node): Add calls_comdat_local.
	(symtab_comdat_local_p, symtab_in_same_comdat_p): New.
	* cif-code.def: Add USES_COMDAT_LOCAL.
	* symtab.c (verify_symtab_base): Make sure we don't refer to a
	comdat-local symbol from outside its comdat.
	* cgraph.c (verify_cgraph_node): Likewise.
	* cgraphunit.c (mark_functions_to_output): Don't mark comdat-locals.
	* ipa.c (symtab_remove_unreachable_nodes): Likewise.
	(function_and_variable_visibility): Handle comdat-local fns.
	* ipa-cp.c (determine_versionability): Don't clone comdat-locals.
	* ipa-inline-analysis.c (compute_inline_parameters): Update
	calls_comdat_local.
	* ipa-inline-transform.c (inline_call): Likewise.
	(save_inline_function_body): Don't clear DECL_COMDAT_GROUP.
	* ipa-inline.c (can_inline_edge_p): Check calls_comdat_local.
	* lto-cgraph.c (input_overwrite_node): Read calls_comdat_local.
	(lto_output_node): Write it.
	* symtab.c (symtab_dissolve_same_comdat_group_list): Clear
	DECL_COMDAT_GROUP for comdat-locals.
include/
	* demangle.h (enum gnu_v3_ctor_kinds):
	Added literal gnu_v3_unified_ctor.
	(enum gnu_v3_ctor_kinds):
	Added literal gnu_v3_unified_dtor.
libiberty/
	* cp-demangle.c (cplus_demangle_fill_ctor,cplus_demangle_fill_dtor):
	Handle unified ctor/dtor.
	(d_ctor_dtor_name): Handle unified ctor/dtor.

From-SVN: r206182
2013-12-23 12:49:47 -05:00
Cary Coutant 85d09f6173 Fix demangler to handle conversion operators correctly.
libiberty/
	PR other/59195
	* cp-demangle.c (struct d_info_checkpoint): New struct.
	(struct d_print_info): Add current_template field.
	(d_operator_name): Set flag when processing a conversion
	operator.
	(cplus_demangle_type): When processing <template-args> for
	a conversion operator, backtrack if necessary.
	(d_expression_1): Renamed from d_expression.
	(d_expression): New wrapper around d_expression_1.
	(d_checkpoint): New function.
	(d_backtrack): New function.
	(d_print_init): Initialize current_template.
	(d_print_comp): Set current_template.
	(d_print_cast): Put current_template in scope for
	printing conversion operator name.
	(cplus_demangle_init_info): Initialize is_expression and
	is_conversion.
	* cp-demangle.h (struct d_info): Add is_expression and
	is_conversion fields.
	* testsuite/demangle-expected: New test cases.

From-SVN: r205292
2013-11-22 14:25:49 -08:00
Uros Bizjak 27297d2d1b cp-demangle.c (d_copy_templates): Cast result of malloc to (struct d_print_template *).
* cp-demangle.c (d_copy_templates): Cast result of malloc
	to (struct d_print_template *).
	(d_print_comp): Cast result of realloc to (struct d_saved scope *).

From-SVN: r204713
2013-11-12 21:02:21 +01:00
Gary Benson c24d86bcb2 cp-demangle.c (struct d_saved_scope): New structure.
libiberty/
2013-10-25  Gary Benson  <gbenson@redhat.com>

	* cp-demangle.c (struct d_saved_scope): New structure.
	(struct d_print_info): New fields saved_scopes and
	num_saved_scopes.
	(d_print_init): Initialize the above.
	(d_print_free): New function.
	(cplus_demangle_print_callback): Call the above.
	(d_copy_templates): New function.
	(d_print_comp): New variables saved_templates and
	need_template_restore.
	[DEMANGLE_COMPONENT_REFERENCE,
	DEMANGLE_COMPONENT_RVALUE_REFERENCE]: Capture scope the first
	time the component is traversed, and use the captured scope for
	subsequent traversals.
	* testsuite/demangle-expected: Add regression test.

From-SVN: r204068
2013-10-25 13:56:51 +00:00
Paul Pluzhnikov ea0882a0ab cp-demangle.c (d_name): Demangle local-source-names.
2013-10-11  Paul Pluzhnikov  <ppluzhnikov@google.com>

	* cp-demangle.c (d_name): Demangle local-source-names.
	* testsuite/demangle-expected: New test.

From-SVN: r203476
2013-10-11 17:31:18 -07:00
Paolo Carlini 8b415b271e re PR bootstrap/58386 (libstdc++.so.6: undefined symbol: htab_hash_pointer)
2013-09-10  Paolo Carlini  <paolo.carlini@oracle.com>

	PR bootstrap/58386
	Revert:

	2013-09-10  Gary Benson  <gbenson@redhat.com>

	* cp-demangle.c: Include hashtab.h.
	(struct d_print_info): New field saved_scopes.
	(d_print_init): Initialize the above.
	(d_print_free): New function.
	(cplus_demangle_print_callback): Call the above.
	(struct d_saved_scope): New structure.
	(d_store_scope): New function.
	(d_free_scope) Likewise.
	(d_restore_scope) Likewise.
	(d_hash_saved_scope) Likewise.
	(d_equal_saved_scope) Likewise.
	(d_print_comp): New variable saved_scope.
	[DEMANGLE_COMPONENT_REFERENCE,
	DEMANGLE_COMPONENT_RVALUE_REFERENCE]: Capture scope the first
	time the component is traversed, and use the captured scope for
	subsequent traversals.

From-SVN: r202480
2013-09-10 18:45:29 +00:00
Gary Benson 669ea36c4a cp-demangle.c: Include hashtab.h.
2013-09-10  Gary Benson  <gbenson@redhat.com>

	* cp-demangle.c: Include hashtab.h.
	(struct d_print_info): New field saved_scopes.
	(d_print_init): Initialize the above.
	(d_print_free): New function.
	(cplus_demangle_print_callback): Call the above.
	(struct d_saved_scope): New structure.
	(d_store_scope): New function.
	(d_free_scope) Likewise.
	(d_restore_scope) Likewise.
	(d_hash_saved_scope) Likewise.
	(d_equal_saved_scope) Likewise.
	(d_print_comp): New variable saved_scope.
	[DEMANGLE_COMPONENT_REFERENCE,
	DEMANGLE_COMPONENT_RVALUE_REFERENCE]: Capture scope the first
	time the component is traversed, and use the captured scope for
	subsequent traversals.

From-SVN: r202442
2013-09-10 12:33:50 +00:00
Jason Merrill 0861bec80a cp-demangle.c (cplus_demangle_type): Fix function quals.
libiberty/
	* cp-demangle.c (cplus_demangle_type): Fix function quals.
	(d_pointer_to_member_type): Simplify.
gcc/cp/
	* mangle.c (write_type): When writing a function type with
	function-cv-quals, don't add the unqualified type as a
	substitution candidate.

From-SVN: r197460
2013-04-03 20:14:00 -04:00
Jason Merrill 9eb85f2724 Demangle C++11 ref-qualifier.
include/
	* demangle.h (enum demangle_component_type): Add
	DEMANGLE_COMPONENT_REFERENCE_THIS,
	DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS.
libiberty/
	* cp-demangle.c (d_ref_qualifier): New.
	(d_nested_name, d_function_type): Use it.
	(d_parmlist): Don't get confused by a ref-qualifier.
	(cplus_demangle_type): Reorder ref-qualifier.
	(d_pointer_to_member_type): Likewise.
	(d_dump): Handle DEMANGLE_COMPONENT_REFERENCE_THIS and
	DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS.
	(d_make_comp, has_return_type, d_encoding): Likewise.
	(d_print_comp, d_print_mod_list, d_print_mod): Likewise.
	(d_print_function_type, is_ctor_or_dtor): Likewise.

From-SVN: r197436
2013-04-03 13:24:12 -04:00
Jason Merrill 622aac0b88 re PR c++/55223 ([C++11] Default lambda expression of a templated class member)
PR c++/55223
gcc/cp/
	* pt.c (tsubst_copy_and_build) [LAMBDA_EXPR]: Fix handling of
	default argument scope.
	* mangle.c (write_name): Likewise.
libiberty/
	* cp-demangle.c (d_dump): Handle DEMANGLE_COMPONENT_DEFAULT_ARG.
	(d_print_comp): Likewise.

From-SVN: r196065
2013-02-14 20:26:44 -05:00
Jason Merrill c61e8502c1 cp-demangle.c (d_unqualified_name): Handle abi tags here.
* cp-demangle.c (d_unqualified_name): Handle abi tags here.
	(d_name): Not here.

From-SVN: r193401
2012-11-10 21:11:15 -05:00
Jason Merrill 7dbb85a793 Add C++ attribute abi_tag and -Wabi-tag option.
gcc/
	* attribs.c (lookup_attribute_spec): Handle getting a TREE_LIST.
gcc/c-family/
	* c.opt (Wabi-tag): New.
gcc/cp/
	* tree.c (cxx_attribute_table): Add abi_tag attribute.
	(check_abi_tag_redeclaration, handle_abi_tag_attribute): New.
	* class.c (find_abi_tags_r, check_abi_tags): New.
	(check_bases, check_field_decl): Call check_abi_tags.
	* decl.c (redeclaration_error_message): Call
	check_abi_tag_redeclaration.
	* mangle.c (tree_string_cmp, write_abi_tags): New.
	(write_unqualified_name): Call write_abi_tags.
include/
	* demangle.h (enum demangle_component_type): Add
	DEMANGLE_COMPONENT_TAGGED_NAME.
libiberty/
	* cp-demangle.c (d_dump): Handle DEMANGLE_COMPONENT_TAGGED_NAME.
	(d_make_comp, d_find_pack, d_print_comp): Likewise.
	(d_abi_tags): New.
	(d_name): Call it.

From-SVN: r193367
2012-11-09 11:14:37 -05:00
Jason Merrill 7c424acd9a Allow dynamic initialization of thread_locals.
gcc/cp/
	* decl.c: Define tls_aggregates.
	(expand_static_init): Remove sorry.  Add to tls_aggregates.
	* cp-tree.h: Declare tls_aggregates.
	* call.c (set_up_extended_ref_temp): Add to tls_aggregates.
	* decl2.c (var_needs_tls_wrapper): New.
	(var_defined_without_dynamic_init): New.
	(get_tls_init_fn, get_tls_wrapper_fn): New.
	(generate_tls_wrapper, handle_tls_init): New.
	(cp_write_global_declarations): Call handle_tls_init and
	enerate_tls_wrapper.
	* mangle.c (write_guarded_var_name): Split out from..
	(mangle_guard_variable): ...here.
	(mangle_tls_init_fn, mangle_tls_wrapper_fn): Use it.
	(decl_tls_wrapper_p): New.
	* semantics.c (finish_id_expression): Replace use of thread_local
	variable with a call to its wrapper.
libiberty/
	* cp-demangle.c (d_special_name, d_dump): Handle TH and TW.
	(d_make_comp, d_print_comp): Likewise.
include/
	* demangle.h (enum demangle_component_type): Add
	DEMANGLE_COMPONENT_TLS_INIT and DEMANGLE_COMPONENT_TLS_WRAPPER.

From-SVN: r192211
2012-10-08 10:45:37 -04:00
Jason Merrill aefa74bd2b cp-demangle.c (cplus_demangle_operators): Add *_cast.
* cp-demangle.c (cplus_demangle_operators): Add *_cast.
	(op_is_new_cast): New.
	(d_expression, d_print_comp): Check it.

From-SVN: r189630
2012-07-18 15:51:36 -04:00
Tom Tromey d931f693ce demangle-expected: Add regression test.
http://sourceware.org/bugzilla/show_bug.cgi?id=14065
	* testsuite/demangle-expected: Add regression test.
	* cp-demangle.c (d_find_pack): Return NULL for
	DEMANGLE_COMPONENT_UNNAMED_TYPE.

From-SVN: r187773
2012-05-22 13:55:02 +00:00
Jason Merrill c19267cbaf mangle.c (write_type): Handle 'auto'.
gcc/cp/
	* mangle.c (write_type): Handle 'auto'.
	* init.c (build_new): Don't do auto deduction where it might
	affect template mangling.
libiberty/
	* cp-demangle.c (cplus_demangle_type): Handle 'auto'.

From-SVN: r185595
2012-03-21 00:04:39 -04:00
Jason Merrill c93ea196be cp-demangle.c (cplus_demangle_operators): Add li.
* cp-demangle.c (cplus_demangle_operators): Add li.
	(d_unqualified_name): Handle it specially.

From-SVN: r185082
2012-03-07 18:19:06 -05:00
Jason Merrill 3abbe4587d cp-demangle.c (d_print_comp): Omit a trailing space in the operator name.
* cp-demangle.c (d_print_comp) [DEMANGLE_COMPONENT_OPERATOR]:
	Omit a trailing space in the operator name.

From-SVN: r183072
2012-01-10 12:02:52 -05:00
Jason Merrill 4b6aaa996e re PR c++/6057 (expression mangling doesn't work for operator new)
PR c++/6057
	PR c++/48051
	PR c++/50855
	PR c++/51322
gcc/cp/
	* mangle.c (write_expression): Support NEW_EXPR, DELETE_EXPR,
	THROW_EXPR, CONSTRUCTOR, OVERLOAD.  Fix PREINCREMENT_EXPR and
	PREDECREMENT_EXPR.
	(write_template_arg): Fix mangling of class-scope functions and
	argument packs.
	(mangle_decl): Update suggested -fabi-version argument.
	* operators.def: Add DOTSTAR_EXPR, REINTERPRET_CAST_EXPR,
	DYNAMIC_CAST_EXPR; correct CONST_CAST_EXPR, STATIC_CAST_EXPR.
	* tree.c (dependent_name): No longer static.
	* cp-tree.h: Declare it.
	* pt.c (unify): Defer handling of unconverted functions.
include/
	* demangle.h (enum demangle_component_type): Add
	DEMANGLE_COMPONENT_INITIALIZER_LIST, DEMANGLE_COMPONENT_NULLARY.
libiberty/
	* cp-demangle.c (d_dump): Handle DEMANGLE_COMPONENT_NULLARY and
	DEMANGLE_COMPONENT_INITIALIZER_LIST.
	(d_make_comp): Likewise.  Allow null right arg for
	DEMANGLE_COMPONENT_TRINARY_ARG2.
	(cplus_demangle_operators): Adjust new/delete; add .*, :: and throw.
	(d_template_args, d_template_arg): Handle 'J' for argument packs.
	(d_exprlist): Add terminator parm.
	(d_expression, d_print_comp): Handle initializer lists, nullary
	expressions, prefix/suffix operators, and new.
	(d_print_subexpr): Avoid parens around DEMANGLE_COMPONENT_QUAL_NAME
	and DEMANGLE_COMPONENT_INITIALIZER_LIST.
	* testsuite/demangle-expected: Add tests.

From-SVN: r182970
2012-01-06 16:39:43 -05:00
Jason Merrill 49f2da1a16 cp-demangle.c (cplus_demangle_type): decltype, pack expansion and vector are substitutable.
* cp-demangle.c (cplus_demangle_type): decltype, pack expansion
	and vector are substitutable.
	(cplus_demangle_operators): Sort.

From-SVN: r182969
2012-01-06 16:39:34 -05:00
Aldy Hernandez 0a35513e4e Merge from transactional-memory branch.
From-SVN: r181154
2011-11-08 11:13:41 +00:00
Jason Merrill b25dd954c4 re PR c++/48370 (G++ fails to extend reference temporary lifetime in some situations)
PR c++/48370
	* call.c (extend_ref_init_temps, extend_ref_init_temps_1): New.
	(set_up_extended_ref_temp): Use it.  Change cleanup parm to VEC.
	(initialize_reference): Just call convert_like.
	* decl.c (grok_reference_init): Just call initialize_reference.
	(build_init_list_var_init): Remove.
	(check_initializer): Change cleanup parm to VEC.  Handle references
	like other types.  Call perform_implicit_conversion instead
	of build_init_list_var_init.  Don't use build_aggr_init for
	aggregate initialization of arrays.
	(cp_finish_decl): Change cleanup to VEC.
	* typeck2.c (store_init_value): Call extend_ref_init_temps.
	Use build_vec_init for non-constant arrays.
	* init.c (expand_aggr_init_1): Adjust.
	(build_vec_init): Avoid re-converting an initializer
	that's already digested.
	* mangle.c (mangle_ref_init_variable): Add a discriminator.
	* cp-tree.h: Adjust.
	* typeck.c (convert_for_initialization): Adjust.
	* decl2.c (maybe_emit_vtables): Adjust.

From-SVN: r180944
2011-11-04 08:54:08 -04:00
Ian Lance Taylor d58818f7ba re PR c++/48665 (type of const member function)
PR c++/48665
	* cp-demangle.c (d_cv_qualifiers): If qualifiers are applied to a
	function type, change them to apply to the "this" parameter.
	* testsuite/demangle-expected: Add test case.

From-SVN: r179772
2011-10-10 20:34:20 +00:00
Cary Coutant 2d2b02c4da re PR c++/40831 (g++ generated symbols for cloned function that be demangled.)
include/ChangeLog:

	PR 40831
	* demangle.h (enum demangle_component_type): Add
	DEMANGLE_COMPONENT_CLONE.

libiberty/ChangeLog:

	PR 40831
	* cp-demangle.c (d_make_comp): Add new component type.
	(cplus_demangle_mangled_name): Check for clone suffixes.
	(d_parmlist): Don't error out if we see '.'.
	(d_clone_suffix): New function.
	(d_print_comp): Print info for clone suffixes.
	* testsuite/demangle-expected: Add new testcases.

From-SVN: r179132
2011-09-23 14:39:10 -07:00
Jason Merrill 4bbff96e36 re PR c++/49932 ([C++0x] ICE on instantiating decltype(expr)::type with template)
PR c++/49932
gcc/cp/
	* mangle.c (write_prefix): Handle decltype.
libiberty/
	* cp-demangle.c (d_prefix): Handle decltype.

From-SVN: r177074
2011-08-01 17:02:07 -04:00
Ian Lance Taylor f2e6f32e60 cp-demangle.c (d_print_init): Initialize pack_index field.
* cp-demangle.c (d_print_init): Initialize pack_index field.
	(d_print_comp): Check for NULL template argument.
	* testsuite/demangle-expected: Add test case.

From-SVN: r176791
2011-07-26 14:28:23 +00:00
Jason Merrill a517066db8 cp-demangle.c (d_expression): Handle 'this'.
* cp-demangle.c (d_expression): Handle 'this'.
	(d_print_comp) [DEMANGLE_COMPONENT_FUNCTION_PARAM]: Likewise.

From-SVN: r175836
2011-07-04 17:44:11 -04:00
Jan Kratochvil cb0ad10428 re PR debug/49408 (member function template id not matching linkage name)
libiberty/
	PR debug/49408
	* cp-demangle.c (d_print_comp): Suppress argument list for function
	references by the '&' unary operator.  Keep also already processed
	variant without the argument list.  Suppress argument list types for
	function call used in an expression.
	* testsuite/demangle-expected: Fix excessive argument list types in
	`test for typed function in decltype'.  New testcase for no argument
	list types printed.  3 new testcases for function references by the
	'&' unary operator..

From-SVN: r175761
2011-07-01 17:16:44 +00:00
Jason Merrill dd70e080ff re PR c++/37089 ([C++0x] rvalue/lvalue reference collapsing not performed in error ouput thus printing "&&&")
PR c++/37089
	* cp-demangle.c (d_print_comp): Handle reference smashing.

From-SVN: r175213
2011-06-20 10:40:01 -04:00
Jan Kratochvil 5fe8e1e9ab cp-demangle.c (d_print_comp): Suppress d_print_mod for DMGL_RET_POSTFIX.
libiberty/
	* cp-demangle.c (d_print_comp) <DEMANGLE_COMPONENT_FUNCTION_TYPE>:
	Suppress d_print_mod for DMGL_RET_POSTFIX.
	* testsuite/demangle-expected: New testcases for --ret-postfix.

From-SVN: r175001
2011-06-13 22:34:19 +00:00
Jan Kratochvil f019462c62 demangle.h (DMGL_RET_POSTFIX): Extend the comment.
include/
	* demangle.h (DMGL_RET_POSTFIX): Extend the comment.
	(DMGL_RET_DROP): New.

libiberty/
	* cp-demangle.c (d_print_comp) <DEMANGLE_COMPONENT_FUNCTION_TYPE>: Do
	not pass DMGL_RET_POSTFIX or DMGL_RET_DROP.  Support DMGL_RET_DROP.
	* testsuite/demangle-expected: New testcases for --ret-drop.
	* testsuite/test-demangle.c: Document --ret-drop in a comment.
	(main): New variable ret_drop, fill it, call cplus_demangle with it.

From-SVN: r175000
2011-06-13 22:32:40 +00:00
Jan Kratochvil 743a99db07 cp-demangle.c (struct d_print_info): Remove field options.
libiberty/
	* cp-demangle.c (struct d_print_info): Remove field options.
	(d_print_init): Remove parameter options.
	(cplus_demangle_print_callback): Update all the callers.
	(d_print_comp, d_print_mod_list, d_print_mod, d_print_function_type)
	(d_print_array_type, d_print_expr_op, d_print_cast, d_print_subexpr):
	Add parameter options, update all the callers.

From-SVN: r174999
2011-06-13 22:30:02 +00:00
H.J. Lu 431f321fbd Properly demangle a global constructor symbol.
2010-11-16  H.J. Lu  <hongjiu.lu@intel.com>

	PR other/42670
	PR binutils/11137
	* cp-demangle.c (d_make_demangle_mangled_name): New.
	(d_demangle_callback): Use it on DCT_GLOBAL_XTORS.

	* testsuite/demangle-expected: Updated.

From-SVN: r166810
2010-11-16 09:56:50 -08:00
Ian Lance Taylor 759fe2404d re PR other/46332 (__cxa_demangle yields excess parentheses for function types)
libiberty/:
	PR other/46332
	* cp-demangle.c (d_print_function_type): Don't print parentheses
	if there are no modifiers to print.
	* testsuite/demangle-expected: Tweak one test case, add another.
libstdc++/:
	* testsuite/abi/demangle/abi_examples/14.cc (main): Change
	expected demangling.

From-SVN: r166695
2010-11-13 01:21:12 +00:00
James Lyon 4825561606 cp-demangle.c (d_find_pack): Add case for DEMANGLE_COMPONENT_LAMBDA.
2010-09-10  James Lyon  <jameslyon0@googlemail.com>

	http://sourceware.org/bugzilla/show_bug.cgi?id=11572
	* cp-demangle.c (d_find_pack): Add case for
	DEMANGLE_COMPONENT_LAMBDA.
	* testsuite/demangle-expected: Add regression test.

From-SVN: r164203
2010-09-10 22:41:28 +00:00
Jakub Jelinek 9c4d7e5294 re PR other/43838 (Incorrect output from abi::__cxa_demangle)
PR other/43838
	* cp-demangle.c (struct d_print_info): Add flush_count field.
	(d_print_init): Initialize it to 0.
	(d_print_flush): Increment it.
	(d_print_comp): If needed flush before appending ", ".  Only
	decrement dpi->len if no flushes happened during the recursive
	call.
	* testsuite/demangle-expected: Add a test for this.

From-SVN: r160554
2010-06-10 17:15:18 +02:00
Jason Merrill 14c2101daa Add support for C++0x nullptr.
gcc:
	* c-common.c (c_common_reswords): Add nullptr.
	* c-common.h: Add RID_NULLPTR.  Reorganize C++0x rids.
	* dwarf2out.c (is_base_type): Handle NULLPTR_TYPE.
	(gen_type_die_with_usage): Likewise.
	* dbxout.c (dbxout_type): Likewise.
	* sdbout.c (plain_type_1): Likewise.
gcc/cp:
	* cp-tree.def: Add NULLPTR_TYPE.
	* cp-tree.h: Add nullptr_node.
	(cp_tree_index): Add CPTI_NULLPTR.
	(SCALAR_TYPE_P): Add NULLPTR_TYPE.
	* call.c (null_ptr_cst_p): Handle nullptr.
	(standard_conversion): Likewise.
	(convert_arg_to_ellipsis): Likewise.
	* mangle.c (write_type): Likewise.
	* name-lookup.c (arg_assoc_type): Likewise.
	* parser.c (cp_parser_primary_expression): Likewise.
	* typeck.c (cp_build_binary_op): Likewise.
	(build_reinterpret_cast_1): Likewise.
	* error.c (dump_type): Likewise.
	(dump_type_prefix, dump_type_suffix): Likewise.
	* decl.c (cxx_init_decl_processing): Likewise.
	* cxx-pretty-print.c (pp_cxx_constant): Likewise.
	* cvt.c (ocp_convert): Likewise.
	* rtti.c (typeinfo_in_lib_p, emit_support_tinfos): Put
	nullptr_t tinfo in libsupc++.
libstdc++-v3:
	* config/abi/pre/gnu.ver: Add typeinfo for decltype(nullptr).
libiberty:
	* cp-demangle.c (cplus_demangle_builtin_types): Add nullptr.
	(cplus_demangle_type): Handle nullptr.

From-SVN: r159131
2010-05-06 16:51:52 -04:00
Jason Merrill ce30e6fd06 c-pretty-print.c (pp_c_specifier_qualifier_list): Use () rather than [], and move before the element type.
* c-pretty-print.c (pp_c_specifier_qualifier_list) [VECTOR_TYPE]:
	Use () rather than [], and move before the element type.
	* cp-demangle.c (d_print_mod): Use () rather than [] for vectors.

From-SVN: r157650
2010-03-22 16:38:35 -04:00
Jason Merrill f000c6a763 re PR c++/4926 (C++ ABI needs clarification on mangling of complex expressions)
PR c++/4926
	PR c++/38600
	* mangle.c (write_unqualified_id): Split out from write_expression.
	(write_unqualified_name): Call it.
	(write_member_name): Likewise.
	(write_expression): Support TEMPLATE_ID_EXPR.
	Disambiguate operator names.

From-SVN: r156482
2010-02-03 15:42:48 -05:00
Jason Merrill abfe01cec9 re PR c++/12909 (ambiguity in mangling vector types)
PR c++/12909
	* mangle.c (write_type) [VECTOR_TYPE]: Change mangling.

From-SVN: r156481
2010-02-03 15:42:35 -05:00
Ian Lance Taylor 79b754d47f cp-demangle.c (cplus_demangle_type): Check for invalid type after "DF".
* cp-demangle.c (cplus_demangle_type): Check for invalid type
	after "DF".
	* testsuite/demangle-expected: Add test.

From-SVN: r156226
2010-01-26 04:05:32 +00:00
Jason Merrill 4d43dcdeb5 re PR c++/42338 ([c++0x] ICE on decltype usage with templates)
PR c++/42338
	* mangle.c (write_expression): Handle tree codes that have extra
	arguments in the middle-end.
	* cp-demangle.c (d_print_comp): Fix array index printing.

From-SVN: r156103
2010-01-20 20:58:53 -05:00
H.J. Lu 9b2adcdbc1 Return dgs.alc on success
libiberty/

2010-01-09  Ian Lance Taylor  <iant@google.com>

	PR other/42230
	* cp-demangle.c (d_demangle): Return dgs.alc on success.

libstdc++-v3/

2010-01-09  H.J. Lu  <hongjiu.lu@intel.com>

	PR other/42230
	* testsuite/abi/pr42230.cc: New.

From-SVN: r155785
2010-01-09 16:24:52 -08:00
Jason Merrill d5f4edddeb merge in cxx0x-lambdas-branch@152308
From-SVN: r152318
2009-09-29 23:01:30 -04:00
Jan Kratochvil 23b1a789fd demangle.h (enum demangle_component_type <DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS>) (enum demangle_component_type <DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS>): New.
include
2009-07-17  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* demangle.h
	(enum demangle_component_type <DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS>)
	(enum demangle_component_type <DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS>):
	New.
libiberty
2009-07-17  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* cp-demangle.c (d_print_comp <DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS>)
	(d_print_comp <DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS): New.
	(d_make_comp <DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS>)
	(d_make_comp <DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS): New.
	(d_demangle_callback): The variable type is now declared as enum.
	Replace parser of _GLOBAL_ symbols by a d_make_comp call.

From-SVN: r149756
2009-07-17 19:09:54 +00:00
Ian Lance Taylor 7859dde7ee cp-demangle.c (cplus_demangle_fill_ctor): Fix logic bug.
* cp-demangle.c (cplus_demangle_fill_ctor): Fix logic bug.
	(cplus_demangle_fill_dtor): Likewise.

Co-Authored-By: Ben Elliston <bje@au.ibm.com>

From-SVN: r147699
2009-05-19 12:42:13 +10:00
Jason Merrill 6afcfe0a80 pt.c (make_fnparm_pack): Split out from...
* gcc/cp/pt.c (make_fnparm_pack): Split out from...
        (instantiate_decl): ...here.
        (tsubst_pack_expansion): Handle being called in a late-specified
        return type.
        * libiberty/cp-demangle.c (d_expression): Handle pack expansion.
        (d_find_pack): Handle DEMANGLE_COMPONENT_FUNCTION_PARAM.
        (d_print_subexpr): Don't wrap function parms in ().
        (d_print_comp) [DEMANGLE_COMPONENT_PACK_EXPANSION]: Handle
        not finding a pack.

From-SVN: r145013
2009-03-23 17:03:01 -04:00