aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorArthur Cohen <arthur.cohen@embecosm.com>2024-12-21 22:53:50 +0000
committerArthur Cohen <arthur.cohen@embecosm.com>2025-03-21 12:55:44 +0100
commitb76ee925818b5617ec3b86e07edbf1f880d5e6e7 (patch)
tree201bec69b78d6f2c9d59cb8b9ee5ca5024e9a69c /gcc
parent2c883bb004c08cef9bf01f90cf39108e14dd98b5 (diff)
downloadgcc-b76ee925818b5617ec3b86e07edbf1f880d5e6e7.zip
gcc-b76ee925818b5617ec3b86e07edbf1f880d5e6e7.tar.gz
gcc-b76ee925818b5617ec3b86e07edbf1f880d5e6e7.tar.bz2
gccrs: ast: Add new constructors for PathInExpression
This commit adds two new constructors for AST::PathInExpression: One using a provided lang-item, and one with an already built std::unique_ptr<Path> gcc/rust/ChangeLog: * ast/rust-path.h: Add two new constructors.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/ast/rust-path.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/gcc/rust/ast/rust-path.h b/gcc/rust/ast/rust-path.h
index 563ad52..39d42fd 100644
--- a/gcc/rust/ast/rust-path.h
+++ b/gcc/rust/ast/rust-path.h
@@ -715,6 +715,24 @@ public:
marked_for_strip (false)
{}
+ PathInExpression (LangItem::Kind lang_item_kind,
+ std::vector<Attribute> outer_attrs, location_t locus)
+ : outer_attrs (std::move (outer_attrs)),
+ has_opening_scope_resolution (false), locus (locus),
+ _node_id (Analysis::Mappings::get ().get_next_node_id ()),
+ path (Rust::make_unique<LangItemPath> (lang_item_kind, locus)),
+ marked_for_strip (false)
+ {}
+
+ PathInExpression (std::unique_ptr<Path> path,
+ std::vector<Attribute> outer_attrs, location_t locus,
+ bool has_opening_scope_resolution = false)
+ : outer_attrs (std::move (outer_attrs)),
+ has_opening_scope_resolution (has_opening_scope_resolution),
+ locus (locus), _node_id (Analysis::Mappings::get ().get_next_node_id ()),
+ path (std::move (path)), marked_for_strip (false)
+ {}
+
PathInExpression (const PathInExpression &other)
: outer_attrs (other.outer_attrs),
has_opening_scope_resolution (other.has_opening_scope_resolution),
@@ -738,7 +756,8 @@ public:
// Creates an error state path in expression.
static PathInExpression create_error ()
{
- return PathInExpression ({}, {}, UNDEF_LOCATION);
+ return PathInExpression (std::vector<PathExprSegment> (), {},
+ UNDEF_LOCATION);
}
// Returns whether path in expression is in an error state.