diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2015-05-22 06:07:17 -0300 |
---|---|---|
committer | Alexandre Oliva <aoliva@redhat.com> | 2016-02-19 19:55:02 -0200 |
commit | 5c1e480991f4e2650910e2b6cd09e10fe5c47f74 (patch) | |
tree | 2e9c438d6c95245bccc080dbeebadefc5c2a3448 /libcc1 | |
parent | acfaea219c7b6fc132800b3bbbc38945b028022c (diff) | |
download | gcc-5c1e480991f4e2650910e2b6cd09e10fe5c47f74.tar.gz |
Fix function overloads. Simplify plugin_bind.
_gdb_expr is extern C, which makes C the current language, which causes
decls created within to be regarded as extern C as well, so overloading
is not possible. I'm overriding the lang setting for now, but if my
plan goes through, the oracle will run get a different context that will
make C++ the current language.
While looking into this, I have simplified decl binding, so that changes
to the C++ front-end can be reverted, since no internal functions are
used any more.
Diffstat (limited to 'libcc1')
-rw-r--r-- | libcc1/libcp1plugin.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libcc1/libcp1plugin.cc b/libcc1/libcp1plugin.cc index d888b0a910a..543dc4cd189 100644 --- a/libcc1/libcp1plugin.cc +++ b/libcc1/libcp1plugin.cc @@ -433,6 +433,7 @@ plugin_build_decl (cc1_plugin::connection *self, { decl = build_lang_decl (code, identifier, sym_type); DECL_SOURCE_LOCATION (decl) = loc; + SET_DECL_LANGUAGE (decl, lang_cplusplus); // FIXME: current_lang_name is lang_name_c while compiling an extern "C" function, and we haven't switched to a global context at this point, and this breaks function overloading. } else decl = build_decl (loc, code, identifier, sym_type); @@ -471,7 +472,15 @@ plugin_bind (cc1_plugin::connection *, gcc_decl decl_in, int is_global) { tree decl = convert_in (decl_in); - cp_bind (DECL_SOURCE_LOCATION (decl), decl, is_global); + + if (is_global) + push_nested_namespace (global_namespace); + + pushdecl_maybe_friend (decl, false); + + if (is_global) + pop_nested_namespace (global_namespace); + rest_of_decl_compilation (decl, is_global, 0); return 1; } |