Age | Commit message (Collapse) | Author | Files | Lines |
|
gcc/rust/ChangeLog:
* rust-backend.h
(Backend::Backend): New.
(Backend::~Backend): Remove.
(class Gcc_backend): Remove.
* rust-gcc.cc
(Gcc_backend::Gcc_backend): Rename to ...
(Backend::Backend): ... here.
(rust_get_backend): Construct Backend instead of Gcc_backend.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
When some proc macro create tokens and later have some code referring to
those created tokens the code was missing a linemap since the pointer
was null, throwing an ICE.
gcc/rust/ChangeLog:
* expand/rust-proc-macro.cc (tokenstream_from_string): Change
linemap null pointer to the current linemap.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Insert proc macro definition from extern crates.
gcc/rust/ChangeLog:
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit):
Add proc macro definition insertion.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Since the node id already is contained into the proc macro we may omit
it from the function arguments.
gcc/rust/ChangeLog:
* util/rust-hir-map.cc (Mappings::insert_derive_proc_macro_def):
Change the function body to fetch the node id from the macro
parameter.
(Mappings::insert_bang_proc_macro_def): Likewise.
(Mappings::insert_attribute_proc_macro_def): Likewise.
* util/rust-hir-map.h: Update the function's prototype by
removing the node id from the list of arguments.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Add definition retrieval for derive and attribute proc macro types.
gcc/rust/ChangeLog:
* resolve/rust-early-name-resolver-2.0.cc (Early::visit_attributes):
Add proc macro handle retrieval for attribute and derive proc macros.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Continue changing the api to use optionals instead of bools and double
pointers.
gcc/rust/ChangeLog:
* util/rust-hir-map.cc (Mappings::lookup_derive_proc_macro_def):
Update function to accomodate new signature.
(Mappings::lookup_bang_proc_macro_def): Likewise.
(Mappings::lookup_attribute_proc_macro_def): Likewise.
* util/rust-hir-map.h: Update function signatures.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
The old interface for those mappings was clunky at best. Now we can use
the optional structure to return a reference to the instance.
gcc/rust/ChangeLog:
* expand/rust-macro-expand.h (struct MacroExpander): Update
lookup function prototypes.
* util/rust-hir-map.cc (Mappings::lookup_derive_proc_macro_invocation):
Update lookup function according to new signature.
(Mappings::lookup_bang_proc_macro_invocation): Likewise.
(Mappings::lookup_attribute_proc_macro_invocation): Likewise.
* util/rust-hir-map.h: Update function prototypes.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
gcc/rust/ChangeLog:
* rust-backend.h
(Backend::write_export_data): Remove.
* rust-gcc.cc
(Backend::write_export_data): Remove.
|
|
gcc/rust/ChangeLog:
* rust-backend.h
(Backend::real_part_expression): Make non-virtual.
(Backend::imag_part_expression): Likewise.
(Backend::complex_expression): Likewise.
(Backend::convert_expression): Likewise.
(Backend::struct_field_expression): Likewise.
(Backend::compound_expression): Likewise.
(Backend::conditional_expression): Likewise.
(Backend::negation_expression): Likewise.
(Backend::arithmetic_or_logical_expression): Likewise.
(Backend::arithmetic_or_logical_expression_checked): Likewise.
(Backend::comparison_expression): Likewise.
(Backend::lazy_boolean_expression): Likewise.
(Backend::constructor_expression): Likewise.
(Backend::array_constructor_expression): Likewise.
(Backend::array_initializer): Likewise.
(Backend::array_index_expression): Likewise.
(Backend::call_expression): Likewise.
(Gcc_backend::real_part_expression): Remove.
(Gcc_backend::imag_part_expression): Remove.
(Gcc_backend::complex_expression): Remove.
(Gcc_backend::convert_expression): Remove.
(Gcc_backend::struct_field_expression): Remove.
(Gcc_backend::compound_expression): Remove.
(Gcc_backend::conditional_expression): Remove.
(Gcc_backend::negation_expression): Remove.
(Gcc_backend::arithmetic_or_logical_expression): Remove.
(Gcc_backend::arithmetic_or_logical_expression_checked): Remove.
(Gcc_backend::comparison_expression): Remove.
(Gcc_backend::lazy_boolean_expression): Remove.
(Gcc_backend::constructor_expression): Remove.
(Gcc_backend::array_constructor_expression): Remove.
(Gcc_backend::array_initializer): Remove.
(Gcc_backend::array_index_expression): Remove.
(Gcc_backend::call_expression): Remove.
* rust-gcc.cc
(Gcc_backend::real_part_expression): Rename to ...
(Backend::real_part_expression): ... here.
(Gcc_backend::imag_part_expression): Rename to ...
(Backend::imag_part_expression): ... here.
(Gcc_backend::complex_expression): Rename to ...
(Backend::complex_expression): ... here.
(Gcc_backend::convert_expression): Rename to ...
(Backend::convert_expression): ... here.
(Gcc_backend::struct_field_expression): Rename to ...
(Backend::struct_field_expression): ... here.
(Gcc_backend::compound_expression): Rename to ...
(Backend::compound_expression): ... here.
(Gcc_backend::conditional_expression): Rename to ...
(Backend::conditional_expression): ... here.
(Gcc_backend::negation_expression): Rename to ...
(Backend::negation_expression): ... here.
(Gcc_backend::arithmetic_or_logical_expression): Rename to ...
(Backend::arithmetic_or_logical_expression): ... here.
(Gcc_backend::arithmetic_or_logical_expression_checked): Rename to ...
(Backend::arithmetic_or_logical_expression_checked): ... here.
(Gcc_backend::comparison_expression): Rename to ...
(Backend::comparison_expression): ... here.
(Gcc_backend::lazy_boolean_expression): Rename to ...
(Backend::lazy_boolean_expression): ... here.
(Gcc_backend::constructor_expression): Rename to ...
(Backend::constructor_expression): ... here.
(Gcc_backend::array_constructor_expression): Rename to ...
(Backend::array_constructor_expression): ... here.
(Gcc_backend::array_initializer): Rename to ...
(Backend::array_initializer): ... here.
(Gcc_backend::array_index_expression): Rename to ...
(Backend::array_index_expression): ... here.
(Gcc_backend::call_expression): Rename to ...
(Backend::call_expression): ... here.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
This part of the code is a bit tricky as it calls multiple functions
with almost the same name and slightly different behaviors. It was even
more with a meaningless variable name.
gcc/rust/ChangeLog:
* rust-session-manager.cc (Session::load_extern_crate): Change
variable name, add temporaries and comments.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Add a templated function to insert any of the three kind of proc macro
into the resolver context.
gcc/rust/ChangeLog:
* expand/rust-proc-macro.h: Change get_trait_name to get_name in
order to be coherent with the others proc macro type name
convention.
* resolve/rust-toplevel-name-resolver-2.0.cc (insert_macros):
Add a templated funtion that inserts a proc macro into the
context and emit an error on failure.
(TopLevel::visit): Change from manual insertion to a function
call.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Change the condition with rust_unreachable to an assertion. This will
keep the code clean and concise.
Some styling issues appeared during review, this commit make the code
more readable.
gcc/rust/ChangeLog:
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit):
Change to assertion.
* util/rust-hir-map.cc (Mappings::lookup_derive_proc_macros):
Add empty line.
(Mappings::lookup_bang_proc_macros): Likewise.
(Mappings::lookup_attribute_proc_macros): Likewise.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Move extern crate resolving under the extern crate declaration instead
of doing it under the crate's root as extern crates are not resolved by
the top level resolver.
gcc/rust/ChangeLog:
* metadata/rust-extern-crate.cc (ExternCrate::ExternCrate):
Update definition to allow Extern crate with no content (pure
proc macros).
(ExternCrate::ok): Panic on no content.
(ExternCrate::load): Likewise.
* metadata/rust-extern-crate.h: Update prototypes.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::go):
Remove macro resolution.
(TopLevel::visit): Likewise.
* resolve/rust-toplevel-name-resolver-2.0.h: Add visit prototype
for extern crate.
* rust-session-manager.cc (Session::load_extern_crate): Adapt
content depending on the loaded crate's content.
* util/rust-hir-map.cc (Mappings::lookup_derive_proc_macros):
Change return type to optional because it is way more
convenient.
(Mappings::lookup_bang_proc_macros): Likewise.
(Mappings::lookup_attribute_proc_macros): Likewise.
* util/rust-hir-map.h: Update function prototypes.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
This error was emitted when a valid proc macro crate was loaded. Proc
macros do not contain any import data for now.
gcc/rust/ChangeLog:
* metadata/rust-imports.cc (Import::try_package_in_directory):
Remove error when some macro are found even if no import data is
available.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
This commit moves the procedural macros loaded definition from outside
the AST to the mappings. This means most getters/setters around the
mappings had to be changed. This commit also introduces the top level
visit of those mappings instead of visiting the Crate ast members.
gcc/rust/ChangeLog:
* ast/rust-ast.h (class BangProcMacro): Move class from here to
rust-proc-macro.h. Also remove related functions.
(class AttributeProcMacro): Likewise.
(class CustomDeriveProcMacro): Likewise.
(struct Crate): Remove proc macro vector members.
* expand/rust-macro-expand.h (struct MacroExpander): Change the
type to the newly created classes.
* expand/rust-proc-macro.cc (BangProcMacro::BangProcMacro): Add
constructor implementation.
(AttributeProcMacro::AttributeProcMacro): Likewise.
(CustomDeriveProcMacro::CustomDeriveProcMacro): Likewise.
* expand/rust-proc-macro.h (class BangProcMacro): Move class to
here.
(class AttributeProcMacro): Likewise.
(class CustomDeriveProcMacro): Likewise.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::go):
Change top level visitor to check mappings instead
* rust-session-manager.cc (Session::load_extern_crate):
Add back macro collection to mappings.
* util/rust-hir-map.cc (Mappings::insert_derive_proc_macros):
Update getter signature with new types.
(Mappings::insert_bang_proc_macros): Likewise.
(Mappings::insert_attribute_proc_macros): Likewise.
(Mappings::lookup_derive_proc_macros): Likewise.
(Mappings::lookup_bang_proc_macros): Likewise.
(Mappings::lookup_attribute_proc_macros): Likewise.
(Mappings::insert_derive_proc_macro_def): Likewise.
(Mappings::insert_bang_proc_macro_def): Likewise.
(Mappings::insert_attribute_proc_macro_def): Likewise.
(Mappings::lookup_derive_proc_macro_def): Likewise.
(Mappings::lookup_bang_proc_macro_def): Likewise.
(Mappings::lookup_attribute_proc_macro_def): Likewise.
(Mappings::insert_derive_proc_macro_invocation): Likewise.
(Mappings::lookup_derive_proc_macro_invocation): Likewise.
(Mappings::insert_bang_proc_macro_invocation): Likewise.
(Mappings::lookup_bang_proc_macro_invocation): Likewise.
(Mappings::insert_attribute_proc_macro_invocation): Likewise.
(Mappings::lookup_attribute_proc_macro_invocation): Likewise.
* util/rust-hir-map.h: Update function prototypes as well as map
types.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Add mechanism to discover proc macros in loaded extern crates. In the
top level resolver.
gcc/rust/ChangeLog:
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::go):
Visit crate's newly stored proc macros.
* rust-session-manager.cc (Session::load_extern_crate):
Store proc macros in the parsed crate instead of a local
variable to achieve mappings.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
We do not need to copy the whole vector we can simply take a reference
instead.
gcc/rust/ChangeLog:
* resolve/rust-early-name-resolver-2.0.cc (Early::visit_attributes):
Change argument to reference.
* resolve/rust-early-name-resolver-2.0.h: Update function
prototype.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Add some getters on the ast crate in order to be able to retrieve a
reference to a crate's proc macros.
gcc/rust/ChangeLog:
* ast/rust-ast.h: Add getters.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Add multiple setters for a crate object in order to add macro
abstractions previously introduced.
gcc/rust/ChangeLog:
* ast/rust-ast.h (struct Crate): Add proc macro members.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
When resolving proc macros it is convenient to store every macro
directly in the extern crate. These class in the ast module provide a
better abstraction over the raw ProcMacro::{CustomDerive, Bang,
Attribute} structures provided by the proc_macro library.
gcc/rust/ChangeLog:
* ast/rust-ast.h (class BangProcMacro): Add new proc macro
abstraction.
(class AttributeProcMacro): Likewise.
(class CustomDeriveProcMacro): Likewise.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Add a simple attribute visit function and override StructStruct &
Function visit functions.
gcc/rust/ChangeLog:
* resolve/rust-early-name-resolver-2.0.cc (Early::visit_attributes):
Add function to handle attributes.
(Early::visit): Override visitor functions.
* resolve/rust-early-name-resolver-2.0.h: Add prototype.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Derive attributes should be parsed before attempting to retrieve any
traits. This will convert the tokenstream to a list of path if this
hasn't been done previously.
gcc/rust/ChangeLog:
* ast/rust-ast.cc (Attribute::get_traits_to_derive): Convert
tokenstream to path list.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Member function is_derive was overly constrained, the attribute changes
when we parse it's meta items and it no longer contains a tokenstream
while staying a derive.
gcc/rust/ChangeLog:
* ast/rust-ast.cc (Attribute::is_derive): Remove tokenstream
condition.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Having copy and any other constructor stuff might lead to a breakage in
the future where the node id differs due to a newly constructed
SimplePath node. This change will allow us to assert the NodeId is from
the ast and not any copy made in between.
gcc/rust/ChangeLog:
* ast/rust-ast.cc (Attribute::get_traits_to_derive): Change
return type to a vector of references.
* ast/rust-ast.h: Update constructor.
* expand/rust-expand-visitor.cc (ExpandVisitor::expand_inner_stmts):
Update function call.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
This function will be used outside of the expand visitor, making it
easily accessible is therefore mandatory.
gcc/rust/ChangeLog:
* ast/rust-ast.cc (Attribute::get_traits_to_derive): Add
function as member function.
* ast/rust-ast.h: Add prototype.
* expand/rust-expand-visitor.cc (get_traits_to_derive): Remove
function.
(ExpandVisitor::expand_inner_stmts): Update function call.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
This function will be used in the multiple other places, therefore we
should make it easily usable from there.
gcc/rust/ChangeLog:
* ast/rust-ast.cc (Attribute::is_derive): Add member function.
* ast/rust-ast.h: Likewise.
* expand/rust-expand-visitor.cc (is_derive): Remove old
function.
(ExpandVisitor::expand_inner_stmts): Update function call.
(ExpandVisitor::visit_inner_using_attrs): Likewise.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
We were massing the match scruitinee expression as a way to access the
result of the expression. This is wrong and needs to be stored in a
temporary otherwise it will cause the code to be regnerated for each time
it is used. This is not an issue in the case where the expression is only
used once.
Fixes #1895
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc (CompileExpr::visit): use a temp for the value
gcc/testsuite/ChangeLog:
* rust/execute/torture/iter1.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
gcc/rust/ChangeLog:
* rust-backend.h
(Backend::block): Make non-virtual.
(Backend::block_add_statements): Likewise.
(Gcc_backend::block): Remove.
(Gcc_backend::block_add_statements): Remove.
* rust-gcc.cc
(Gcc_backend::block): Rename to ...
(Backend::block): ... here.
(Gcc_backend::block_add_statements): Rename to ...
(Backend::block_add_statements): ... here.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
The name was a bit misleading since libproc_macro is a rust library that
should we should be able to link against some rust code. This cpp
library was the layer below the libproc_macro library, the "real" gcc
libproc_macro act as a translation layer for the internal library.
gcc/rust/ChangeLog:
* expand/rust-macro-expand.h: Change include directive with the
new name.
* expand/rust-proc-macro.h (RUST_PROC_MACRO_H): Likewise.
* util/rust-hir-map.h: Likewise.
* util/rust-token-converter.h: Likewise.
* util/rust-token-converter.cc: Remove useless include
directive.
* Make-lang.in: Rename library.
libgrust/ChangeLog:
* Makefile.am: Change library name.
* Makefile.in: Likewise.
* configure.ac: Likewise.
* configure: Regenerate.
* libproc_macro/Makefile.am: Moved to...
* libproc_macro_internal/Makefile.am: ...here.
* libproc_macro/Makefile.in: Moved to...
* libproc_macro_internal/Makefile.in: ...here.
* libproc_macro/bridge.h: Moved to...
* libproc_macro_internal/bridge.h: ...here.
* libproc_macro/ffistring.cc: Moved to...
* libproc_macro_internal/ffistring.cc: ...here.
* libproc_macro/ffistring.h: Moved to...
* libproc_macro_internal/ffistring.h: ...here.
* libproc_macro/group.cc: Moved to...
* libproc_macro_internal/group.cc: ...here.
* libproc_macro/group.h: Moved to...
* libproc_macro_internal/group.h: ...here.
* libproc_macro/ident.cc: Moved to...
* libproc_macro_internal/ident.cc: ...here.
* libproc_macro/ident.h: Moved to...
* libproc_macro_internal/ident.h: ...here.
* libproc_macro/literal.cc: Moved to...
* libproc_macro_internal/literal.cc: ...here.
* libproc_macro/literal.h: Moved to...
* libproc_macro_internal/literal.h: ...here.
* libproc_macro/proc_macro.cc: Moved to...
* libproc_macro_internal/proc_macro.cc: ...here.
* libproc_macro/proc_macro.h: Moved to...
* libproc_macro_internal/proc_macro.h: ...here.
* libproc_macro/punct.cc: Moved to...
* libproc_macro_internal/punct.cc: ...here.
* libproc_macro/punct.h: Moved to...
* libproc_macro_internal/punct.h: ...here.
* libproc_macro/registration.h: Moved to...
* libproc_macro_internal/registration.h: ...here.
* libproc_macro/rust/bridge.rs: Moved to...
* libproc_macro_internal/rust/bridge.rs: ...here.
* libproc_macro/rust/bridge/ffistring.rs: Moved to...
* libproc_macro_internal/rust/bridge/ffistring.rs: ...here.
* libproc_macro/rust/bridge/group.rs: Moved to...
* libproc_macro_internal/rust/bridge/group.rs: ...here.
* libproc_macro/rust/bridge/ident.rs: Moved to...
* libproc_macro_internal/rust/bridge/ident.rs: ...here.
* libproc_macro/rust/bridge/literal.rs: Moved to...
* libproc_macro_internal/rust/bridge/literal.rs: ...here.
* libproc_macro/rust/bridge/punct.rs: Moved to...
* libproc_macro_internal/rust/bridge/punct.rs: ...here.
* libproc_macro/rust/bridge/span.rs: Moved to...
* libproc_macro_internal/rust/bridge/span.rs: ...here.
* libproc_macro/rust/bridge/token_stream.rs: Moved to...
* libproc_macro_internal/rust/bridge/token_stream.rs: ...here.
* libproc_macro/rust/group.rs: Moved to...
* libproc_macro_internal/rust/group.rs: ...here.
* libproc_macro/rust/ident.rs: Moved to...
* libproc_macro_internal/rust/ident.rs: ...here.
* libproc_macro/rust/lib.rs: Moved to...
* libproc_macro_internal/rust/lib.rs: ...here.
* libproc_macro/rust/literal.rs: Moved to...
* libproc_macro_internal/rust/literal.rs: ...here.
* libproc_macro/rust/punct.rs: Moved to...
* libproc_macro_internal/rust/punct.rs: ...here.
* libproc_macro/rust/span.rs: Moved to...
* libproc_macro_internal/rust/span.rs: ...here.
* libproc_macro/rust/token_stream.rs: Moved to...
* libproc_macro_internal/rust/token_stream.rs: ...here.
* libproc_macro/span.cc: Moved to...
* libproc_macro_internal/span.cc: ...here.
* libproc_macro/span.h: Moved to...
* libproc_macro_internal/span.h: ...here.
* libproc_macro/tokenstream.cc: Moved to...
* libproc_macro_internal/tokenstream.cc: ...here.
* libproc_macro/tokenstream.h: Moved to...
* libproc_macro_internal/tokenstream.h: ...here.
* libproc_macro/tokentree.cc: Moved to...
* libproc_macro_internal/tokentree.cc: ...here.
* libproc_macro/tokentree.h: Moved to...
* libproc_macro_internal/tokentree.h: ...here.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
gcc/rust/ChangeLog:
* rust-backend.h
(Backend::init_statement): Make non-virtual.
(Backend::assignment_statement): Likewise.
(Backend::return_statement): Likewise.
(Backend::if_statement): Likewise.
(Backend::loop_expression): Likewise.
(Backend::exit_expression): Likewise.
(Backend::compound_statement): Likewise.
(Backend::statement_list): Likewise.
(Backend::exception_handler_statement): Likewise.
(Gcc_backend::init_statement): Remove.
(Gcc_backend::assignment_statement): Remove.
(Gcc_backend::return_statement): Remove.
(Gcc_backend::if_statement): Remove.
(Gcc_backend::compound_statement): Remove.
(Gcc_backend::statement_list): Remove.
(Gcc_backend::exception_handler_statement): Remove.
(Gcc_backend::loop_expression): Remove.
(Gcc_backend::exit_expression): Remove.
* rust-gcc.cc
(Gcc_backend::init_statement): Rename to ...
(Backend::init_statement): ... here.
(Gcc_backend::assignment_statement): Rename to ...
(Backend::assignment_statement): ... here.
(Gcc_backend::return_statement): Rename to ...
(Backend::return_statement): ... here.
(Gcc_backend::exception_handler_statement): Rename to ...
(Backend::exception_handler_statement): ... here.
(Gcc_backend::if_statement): Rename to ...
(Backend::if_statement): ... here.
(Gcc_backend::loop_expression): Rename to ...
(Backend::loop_expression): ... here.
(Gcc_backend::exit_expression): Rename to ...
(Backend::exit_expression): ... here.
(Gcc_backend::compound_statement): Rename to ...
(Backend::compound_statement): ... here.
(Gcc_backend::statement_list): Rename to ...
(Backend::statement_list): ... here.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* rust-backend.h
(Backend::function): Make non-virtual.
(Backend::function_defer_statement): Likewise.
(Backend::function_set_parameters): Likewise.
(Backend::write_global_definitions): Likewise.
(Backend::write_export_data): Likewise.
(Gcc_backend::function): Remove.
(Gcc_backend::function_defer_statement): Remove.
(Gcc_backend::function_set_parameters): Remove.
(Gcc_backend::write_global_definitions): Remove.
(Gcc_backend::write_export_data): Remove.
* rust-gcc.cc
(Gcc_backend::function): Rename to ...
(Backend::function): ... here.
(Gcc_backend::function_defer_statement):
Fix a qualified lookup of Backend::label and rename to ...
(Backend::function_defer_statement): ... here.
(Gcc_backend::function_set_parameters) Rename to ...
(Backend::function_set_parameters): ... here.
(Gcc_backend::write_global_definitions): Rename to ...
(Backend::write_global_definitions): ... here.
(Gcc_backend::write_export_data): Rename to ...
(Backend::write_export_data): ... here.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
defined
gcc/rust/ChangeLog:
* typecheck/rust-hir-inherent-impl-overlap.h:
Added rich location and errorcode.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
likewise.
gcc/testsuite/ChangeLog:
* rust/compile/generics7.rs: Added Errorcode hint.
* rust/compile/generics8.rs: Updated dejagnu comment.
* rust/compile/issue-925.rs: Added Errorcode hint.
Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
|
|
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit):
Added error code.
gcc/testsuite/ChangeLog:
* rust/compile/issue-2029.rs:
Updated for dejagnu testcase.
Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
|
|
gcc/rust/ChangeLog:
* rust-backend.h
(Backend::zero_expression): Make non-virtual.
(Backend::var_expression): Likewise.
(Backend::integer_constant_expression): Likewise.
(Backend::float_constant_expression): Likewise.
(Backend::complex_constant_expression): Likewise.
(Backend::string_constant_expression): Likewise.
(Backend::char_constant_literal): Likewise.
(Backend::wchar_constant_literal): Likewise.
(Backend::boolean_constant_expression): Likewise.
(Gcc_backend::zero_expression): Remove.
(Gcc_backend::var_expression): Remove.
(Gcc_backend::integer_constant_expression): Remove.
(Gcc_backend::float_constant_expression): Remove.
(Gcc_backend::complex_constant_expression): Remove.
(Gcc_backend::string_constant_expression): Remove.
(Gcc_backend::wchar_constant_expression): Remove.
(Gcc_backend::char_constant_expression): Remove.
(Gcc_backend::boolean_constant_expression): Remove.
* rust-gcc.cc
(Gcc_backend::zero_expression): Rename to ...
(Backend::zero_expression): ... here.
(Gcc_backend::var_expression): Rename to ...
(Backend::var_expression): ... here.
(Gcc_backend::integer_constant_expression): Rename to ...
(Backend::integer_constant_expression): ... here.
(Gcc_backend::float_constant_expression): Rename to ...
(Backend::float_constant_expression): ... here.
(Gcc_backend::complex_constant_expression): Rename to ...
(Backend::complex_constant_expression): ... here.
(Gcc_backend::string_constant_expression): Rename to ...
(Backend::string_constant_expression): ... here.
(Gcc_backend::wchar_constant_expression): Rename to ...
(Backend::wchar_constant_expression): ... here.
(Gcc_backend::char_constant_expression): Rename to ...
(Backend::char_constant_expression): ... here.
(Gcc_backend::boolean_constant_expression): Rename to ...
(Backend::boolean_constant_expression): ... here.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* rust-backend.h
(Backend::global_variable): Make non-virtual.
(Backend::global_variable_set_init): Likewise.
(Backend::local_variable): Likewise.
(Backend::parameter_variable): Likewise.
(Backend::static_chain_variable): Likewise.
(Backend::temporary_variable): Likewise.
(Gcc_backend::global_variable): Remove.
(Gcc_backend::global_variable_set_init): Remove.
(Gcc_backend::local_variable): Remove.
(Gcc_backend::parameter_variable): Remove.
(Gcc_backend::static_chain_variable): Remove.
(Gcc_backend::temporary_variable): Remove.
(Gcc_backend::non_zero_size_type): Move to ...
(Backend::non_zero_size_type): ... here.
(Gcc_backend::convert_tree): Move to ...
(Backend::convert_tree): ... here.
* rust-gcc.cc
(Gcc_backend::non_zero_size_type): Rename to ...
(Backend::non_zero_size_type): ... here.
(Gcc_backend::convert_tree): Rename to ...
(Backend::convert_tree): ... here.
(Gcc_backend::global_variable): Rename to ...
(Backend::global_variable): ... here.
(Gcc_backend::global_variable_set_init): Rename to ...
(Backend::global_variable_set_init): ... here.
(Gcc_backend::local_variable): Rename to ...
(Backend::local_variable): ... here.
(Gcc_backend::parameter_variable): Rename to ...
(Backend::parameter_variable): ... here.
(Gcc_backend::static_chain_variable): Rename to ...
(Backend::static_chain_variable): ... here.
(Gcc_backend::temporary_variable): Rename to ...
(Backend::temporary_variable): ... here.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* checks/errors/privacy/rust-privacy-reporter.cc
(PrivacyReporter::check_for_privacy_violation):
Added errorcode & richlocation.
gcc/testsuite/ChangeLog:
* rust/compile/privacy1.rs: Added errorcode.
* rust/compile/privacy3.rs: likewise.
* rust/compile/privacy4.rs: likewise.
* rust/compile/privacy5.rs: likewise.
Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
|
|
gcc/rust/ChangeLog:
* rust-backend.h
(Backend::debug): Make non-virtual.
(Backend::get_identifier_node): Likewise.
(Gcc_backend::debug): Remove.
(Gcc_backend::get_identifier_node): Remove.
* rust-gcc.cc
(Gcc_backend::debug): Rename to ...
(Backend::debug): ... here.
(Gcc_backend::get_identifier_node): Rename to ...
(Backend::get_identifier_node): ... here.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-expr.cc
(TypeCheckExpr::visit): Expect if conditions to have type bool.
gcc/testsuite/ChangeLog:
* rust/compile/type-if.rs: New test.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* rust-backend.h
(Backend::label): Make non-virtual.
(Backend::label_definition_statement): Likewise.
(Backend::goto_statement): Likewise.
(Backend::label_address): Likewise.
(Gcc_backend::label): Remove.
(Gcc_backend::label_definition_statement): Remove.
(Gcc_backend::goto_statement): Remove.
(Gcc_backend::label_address): Remove.
* rust-gcc.cc
(Gcc_backend::label): Rename to ...
(Backend::label): ... here.
(Gcc_backend::label_definition_statement): Rename to ...
(Backend::label_definition_statement): ... here.
(Gcc_backend::goto_statement): Rename to ...
(Backend::goto_statement): ... here.
(Gcc_backend::label_address): Rename to ...
(Backend::label_address): ... here.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* backend/rust-constexpr.cc
(struct constexpr_fundef): Rename to ...
(struct rust_constexpr_fundef): ... here.
(struct constexpr_call): Rename to ...
(struct rust_constexpr_call): ... here.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* lex/rust-input-source.h: Move constants from here...
* util/rust-codepoint.h (struct Codepoint): ... to here
* util/rust-attributes.cc (check_no_mangle_function): New function.
(AttributeChecker::visit): Use it.
* util/rust-unicode.cc (is_ascii_only): New function.
* util/rust-unicode.h (is_ascii_only): Likewise.
* backend/rust-mangle.cc (legacy_mangle_name): Use it.
* util/rust-punycode.cc (extract_basic_string): Likewise.
* lex/rust-lex.cc (Lexer::parse_byte_char): Likewise.
Signed-off-by: Raiki Tamura <tamaron1203@gmail.com>
|
|
gcc/rust/ChangeLog:
* hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::visit):
Added richlocation & error code.
gcc/testsuite/ChangeLog:
* rust/compile/let_alt.rs: Updated comment.
Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
|
|
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-expr.cc
(TypeCheckExpr::resolve_fn_trait_call): Add TODO comment.
* typecheck/rust-tyty-bounds.cc
(TypeBoundPredicate::TypeBoundPredicate):
Add assertions, new error constructor.
(TypeBoundPredicate::error): Use new error constructor.
* typecheck/rust-tyty.h
(struct TypeBoundPredicate::mark_is_error): New.
(TypeBoundPredicate::TypeBoundPredicate):
Add new error constructor.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* rust-backend.h:
(Backend::wchar_type): Make non-virtual.
(Backend::get_pointer_size): Likewise.
(Backend::raw_str_type): Likewise.
(Backend::integer_type): Likewise.
(Backend::float_type): Likewise.
(Backend::complex_type): Likewise.
(Backend::pointer_type): Likewise.
(Backend::reference_type): Likewise.
(Backend::immutable_type): Likewise.
(Backend::function_type): Likewise.
(Backend::function_type_varadic): Likewise.
(Backend::function_ptr_type): Likewise.
(Backend::struct_type): Likewise.
(Backend::union_type): Likewise.
(Backend::array_type): Likewise.
(Backend::named_type): Likewise.
(Backend::type_size): Likewise.
(Backend::type_alignment): Likewise.
(Backend::type_field_alignment): Likewise.
(Backend::type_field_offset): Likewise.
(Gcc_backend::wchar_type): Remove.
(Gcc_backend::get_pointer_size): Remove.
(Gcc_backend::raw_str_type): Remove.
(Gcc_backend::integer_type): Remove.
(Gcc_backend::float_type): Remove.
(Gcc_backend::complex_type): Remove.
(Gcc_backend::pointer_type): Remove.
(Gcc_backend::reference_type): Remove.
(Gcc_backend::immutable_type): Remove.
(Gcc_backend::function_type): Remove.
(Gcc_backend::function_type_varadic): Remove.
(Gcc_backend::function_ptr_type): Remove.
(Gcc_backend::struct_type): Remove.
(Gcc_backend::union_type): Remove.
(Gcc_backend::array_type): Remove.
(Gcc_backend::named_type): Remove.
(Gcc_backend::type_size): Remove.
(Gcc_backend::type_alignment): Remove.
(Gcc_backend::type_field_alignment): Remove.
(Gcc_backend::type_field_offset): Remove.
(Gcc_backend::fill_in_fields): Move to ...
(Backend::fill_in_fields): ... here.
(Gcc_backend::fill_in_array): Move to ...
(Backend::fill_in_array): ... here.
* rust-gcc.cc
(Gcc_backend::wchar_type): Rename to ...
(Backend::wchar_type): ... here.
(Gcc_backend::get_pointer_size): Rename to ...
(Backend::get_pointer_size): ... here.
(Gcc_backend::raw_str_type): Rename to ...
(Backend::raw_str_type): ... here.
(Gcc_backend::integer_type): Rename to ...
(Backend::integer_type): ... here.
(Gcc_backend::float_type): Rename to ...
(Backend::float_type): ... here.
(Gcc_backend::complex_type): Rename to ...
(Backend::complex_type): ... here.
(Gcc_backend::pointer_type): Rename to ...
(Backend::pointer_type): ... here.
(Gcc_backend::reference_type): Rename to ...
(Backend::reference_type): ... here.
(Gcc_backend::immutable_type): Rename to ...
(Backend::immutable_type): ... here.
(Gcc_backend::function_type): Rename to ...
(Backend::function_type): ... here.
(Gcc_backend::function_type_varadic): Rename to ...
(Backend::function_type_varadic): ... here.
(Gcc_backend::function_ptr_type): Rename to ...
(Backend::function_ptr_type): ... here.
(Gcc_backend::struct_type): Rename to ...
(Backend::struct_type): ... here.
(Gcc_backend::union_type): Rename to ...
(Backend::union_type): ... here.
(Gcc_backend::fill_in_fields): Rename to ...
(Backend::fill_in_fields): ... here.
(Gcc_backend::array_type): Rename to ...
(Backend::array_type): ... here.
(Gcc_backend::fill_in_array): Rename to ...
(Backend::fill_in_array): ... here.
(Gcc_backend::named_type): Rename to ...
(Backend::named_type): ... here.
(Gcc_backend::type_size): Rename to ...
(Backend::type_size): ... here.
(Gcc_backend::type_alignment): Rename to ...
(Backend::type_alignment): ... here.
(Gcc_backend::type_field_alignment): Rename to ...
(Backend::type_field_alignment): ... here.
(Gcc_backend::type_field_offset): Rename to ...
(Backend::type_field_offset): ... here.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
The intrinsic move_val_init was being optimized away even at -O0 because
the function looked "pure" but this adds in the attributes to enforce that
this function has side-effects to override that bad assumption by the
middle-end.
Addresses #1895
gcc/rust/ChangeLog:
* backend/rust-compile-intrinsic.cc (move_val_init_handler): mark as side-effects
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
Ensure the uninit intrinsic does not get optimized away
Addresses #1895
gcc/rust/ChangeLog:
* backend/rust-compile-intrinsic.cc (uninit_handler): Update fndecl attributes
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
The overflow intrinsic returns a tuple of (value, boolean) where it value
is the operator result and boolean if it overflowed or not. The intrinsic
here did not initilize the resulting tuple and therefore was creating a use
before init error resulting in garbage results
Addresses #1895
gcc/rust/ChangeLog:
* backend/rust-compile-intrinsic.cc (op_with_overflow_inner): fix use before init
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
We were using the DECL_RESULT but this just contains the TREE_TYPE of the
retval. It was also missing taking the address of the destination for the
memset call. This changes the code to create a temp variable for the return
value and asserts the destination size is the same as the size of the
template param.
Fixes #2583
gcc/rust/ChangeLog:
* backend/rust-compile-intrinsic.cc (enter_intrinsic_block): take the locals vector
(uninit_handler): make a temp variable and use the address of it
gcc/testsuite/ChangeLog:
* rust/execute/torture/issue-2583.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
Use error object instead of lambda for error collection.
gcc/rust/ChangeLog:
* resolve/rust-early-name-resolver-2.0.cc (Early::visit):
Collect error instead of lambda.
* resolve/rust-early-name-resolver-2.0.h (std::function<void):
Remove type alias.
* rust-diagnostics.h: Change collection type.
* rust-session-manager.cc (Session::expansion): Change
collection container.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
We need to collect the early resolver's macros error to emit them at a
later stage after further expansion in order to retrieve macros defined
by other macro invocations.
Register some mappings for macro invocations and macro definitions.
gcc/rust/ChangeLog:
* resolve/rust-early-name-resolver-2.0.cc (Early::visit):
Collect error instead of emitting it. Also add invocation
registration.
* resolve/rust-early-name-resolver-2.0.h (std::function<void):
Add type definition for collection.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit):
Register macro rule definition in mappings.
* rust-session-manager.cc (Session::expansion): Add macro
resolve error collection.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|