diff options
Diffstat (limited to 'gcc/rust/ast')
-rw-r--r-- | gcc/rust/ast/rust-ast-full-test.cc | 14 | ||||
-rw-r--r-- | gcc/rust/ast/rust-ast.h | 8 |
2 files changed, 14 insertions, 8 deletions
diff --git a/gcc/rust/ast/rust-ast-full-test.cc b/gcc/rust/ast/rust-ast-full-test.cc index 5c6a754..71cbb37 100644 --- a/gcc/rust/ast/rust-ast-full-test.cc +++ b/gcc/rust/ast/rust-ast-full-test.cc @@ -4695,7 +4695,10 @@ MetaNameValueStr::to_attribute () const { LiteralExpr lit_expr (str, Literal::LitType::STRING, PrimitiveCoreType::CORETYPE_UNKNOWN, {}, Location ()); - return Attribute (SimplePath::from_str (ident), + // FIXME: What location do we put here? Is the literal above supposed to have + // an empty location as well? + // Should MetaNameValueStr keep a location? + return Attribute (SimplePath::from_str (ident, Location ()), std::unique_ptr<AttrInputLiteral> ( new AttrInputLiteral (std::move (lit_expr)))); } @@ -4722,7 +4725,8 @@ MetaItemSeq::to_attribute () const Attribute MetaWord::to_attribute () const { - return Attribute (SimplePath::from_str (ident), nullptr); + // FIXME: How do we get a location here? + return Attribute (SimplePath::from_str (ident, Location ()), nullptr); } Attribute @@ -4740,7 +4744,8 @@ MetaListPaths::to_attribute () const std::unique_ptr<AttrInputMetaItemContainer> new_seq_container ( new AttrInputMetaItemContainer (std::move (new_seq))); - return Attribute (SimplePath::from_str (ident), + // FIXME: How do we get a location here? + return Attribute (SimplePath::from_str (ident, Location ()), std::move (new_seq_container)); } @@ -4755,7 +4760,8 @@ MetaListNameValueStr::to_attribute () const std::unique_ptr<AttrInputMetaItemContainer> new_seq_container ( new AttrInputMetaItemContainer (std::move (new_seq))); - return Attribute (SimplePath::from_str (ident), + // FIXME: How do we get a location here? + return Attribute (SimplePath::from_str (ident, Location ()), std::move (new_seq_container)); } diff --git a/gcc/rust/ast/rust-ast.h b/gcc/rust/ast/rust-ast.h index fa26175..f2b14ab 100644 --- a/gcc/rust/ast/rust-ast.h +++ b/gcc/rust/ast/rust-ast.h @@ -330,7 +330,7 @@ class SimplePathSegment : public PathSegment // only allow identifiers, "super", "self", "crate", or "$crate" public: // TODO: put checks in constructor to enforce this rule? - SimplePathSegment (std::string segment_name, Location locus = Location ()) + SimplePathSegment (std::string segment_name, Location locus) : segment_name (std::move (segment_name)), locus (locus), node_id (Analysis::Mappings::get ()->get_next_node_id ()) {} @@ -342,7 +342,7 @@ public: // Creates an error SimplePathSegment static SimplePathSegment create_error () { - return SimplePathSegment (std::string ("")); + return SimplePathSegment (std::string (""), Location ()); } std::string as_string () const override; @@ -398,10 +398,10 @@ public: * ensure that this is a valid identifier in path, so be careful. Also, this * will have no location data. * TODO have checks? */ - static SimplePath from_str (std::string str) + static SimplePath from_str (std::string str, Location locus) { std::vector<AST::SimplePathSegment> single_segments - = {AST::SimplePathSegment (std::move (str))}; + = {AST::SimplePathSegment (std::move (str), locus)}; return SimplePath (std::move (single_segments)); } }; |