aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorOwen Avery <powerboat9.gamer@gmail.com>2023-07-10 20:15:19 -0400
committerPhilip Herron <philip.herron@embecosm.com>2023-07-29 16:03:44 +0000
commit611457431b37f8902e6947c3b7845256ad5d5302 (patch)
tree0cf12a9b7fd9edd9d36b4db0e9e2c309c4286dbd /gcc
parent69f6bc9c913b00758ba66c4f9495caf720941875 (diff)
downloadgcc-611457431b37f8902e6947c3b7845256ad5d5302.zip
gcc-611457431b37f8902e6947c3b7845256ad5d5302.tar.gz
gcc-611457431b37f8902e6947c3b7845256ad5d5302.tar.bz2
Remove Location typedef
gcc/rust/ChangeLog: * rust-location.h (typedef Location): Remove. * expand/rust-proc-macro.cc (register_callback): Replace Location constructor with UNDEF_LOCATION. * ast/rust-ast-collector.h: Replace Location with location_t. * checks/errors/privacy/rust-privacy-reporter.cc: Likewise. * checks/errors/privacy/rust-privacy-reporter.h: Likewise. * checks/errors/privacy/rust-pub-restricted-visitor.cc: Likewise. * checks/errors/privacy/rust-pub-restricted-visitor.h: Likewise. * checks/errors/rust-feature-gate.cc: Likewise. * checks/errors/rust-feature-gate.h: Likewise. * metadata/rust-imports.h: Likewise. * resolve/rust-ast-resolve-path.h: Likewise. * resolve/rust-name-resolver.h: Likewise. * rust-backend.h: Likewise. * rust-diagnostics.h: Likewise. * rust-gcc.cc: Likewise. * rust-linemap.h: Likewise. * util/rust-attributes.cc: Likewise. * util/rust-hir-map.cc: Likewise. * util/rust-hir-map.h: Likewise. * util/rust-token-converter.cc: Likewise. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/ast/rust-ast-collector.h2
-rw-r--r--gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc4
-rw-r--r--gcc/rust/checks/errors/privacy/rust-privacy-reporter.h4
-rw-r--r--gcc/rust/checks/errors/privacy/rust-pub-restricted-visitor.cc2
-rw-r--r--gcc/rust/checks/errors/privacy/rust-pub-restricted-visitor.h2
-rw-r--r--gcc/rust/checks/errors/rust-feature-gate.cc2
-rw-r--r--gcc/rust/checks/errors/rust-feature-gate.h2
-rw-r--r--gcc/rust/expand/rust-proc-macro.cc2
-rw-r--r--gcc/rust/metadata/rust-imports.h4
-rw-r--r--gcc/rust/resolve/rust-ast-resolve-path.h2
-rw-r--r--gcc/rust/resolve/rust-name-resolver.h4
-rw-r--r--gcc/rust/rust-backend.h12
-rw-r--r--gcc/rust/rust-diagnostics.h24
-rw-r--r--gcc/rust/rust-gcc.cc11
-rw-r--r--gcc/rust/rust-linemap.h2
-rw-r--r--gcc/rust/rust-location.h2
-rw-r--r--gcc/rust/util/rust-attributes.cc2
-rw-r--r--gcc/rust/util/rust-hir-map.cc2
-rw-r--r--gcc/rust/util/rust-hir-map.h4
-rw-r--r--gcc/rust/util/rust-token-converter.cc2
20 files changed, 45 insertions, 46 deletions
diff --git a/gcc/rust/ast/rust-ast-collector.h b/gcc/rust/ast/rust-ast-collector.h
index 792f8be..2dae423 100644
--- a/gcc/rust/ast/rust-ast-collector.h
+++ b/gcc/rust/ast/rust-ast-collector.h
@@ -160,7 +160,7 @@ public:
void visit (Visitable &v);
void visit (LoopLabel &label);
- void visit (Literal &lit, Location locus = UNDEF_LOCATION);
+ void visit (Literal &lit, location_t locus = UNDEF_LOCATION);
void visit (FunctionParam &param);
void visit (Attribute &attrib);
diff --git a/gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc b/gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc
index 02d5153..8f0d04c 100644
--- a/gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc
+++ b/gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc
@@ -112,7 +112,7 @@ is_child_module (Analysis::Mappings &mappings, NodeId parent,
// FIXME: This function needs a lot of refactoring
void
PrivacyReporter::check_for_privacy_violation (const NodeId &use_id,
- const Location &locus)
+ const location_t locus)
{
NodeId ref_node_id = UNKNOWN_NODEID;
@@ -172,7 +172,7 @@ PrivacyReporter::check_for_privacy_violation (const NodeId &use_id,
void
PrivacyReporter::check_base_type_privacy (Analysis::NodeMapping &node_mappings,
const TyTy::BaseType *ty,
- const Location &locus)
+ const location_t locus)
{
// Avoids repeating commong argument such as `use_id` or `locus` since we're
// doing a lot of recursive calls here
diff --git a/gcc/rust/checks/errors/privacy/rust-privacy-reporter.h b/gcc/rust/checks/errors/privacy/rust-privacy-reporter.h
index 19bb71d..083dd76 100644
--- a/gcc/rust/checks/errors/privacy/rust-privacy-reporter.h
+++ b/gcc/rust/checks/errors/privacy/rust-privacy-reporter.h
@@ -56,7 +56,7 @@ private:
* @param locus Location of said expression/statement
*/
void check_for_privacy_violation (const NodeId &use_id,
- const Location &locus);
+ const location_t locus);
/**
* Internal function used by `check_type_privacy` when dealing with complex
@@ -65,7 +65,7 @@ types
*/
void check_base_type_privacy (Analysis::NodeMapping &node_mappings,
const TyTy::BaseType *ty,
- const Location &locus);
+ const location_t locus);
/**
* Check the privacy of an explicit type.
diff --git a/gcc/rust/checks/errors/privacy/rust-pub-restricted-visitor.cc b/gcc/rust/checks/errors/privacy/rust-pub-restricted-visitor.cc
index 7a2a3d5..4284950 100644
--- a/gcc/rust/checks/errors/privacy/rust-pub-restricted-visitor.cc
+++ b/gcc/rust/checks/errors/privacy/rust-pub-restricted-visitor.cc
@@ -25,7 +25,7 @@ namespace Privacy {
bool
PubRestrictedVisitor::is_restriction_valid (NodeId item_id,
- const Location &locus)
+ const location_t locus)
{
ModuleVisibility visibility;
diff --git a/gcc/rust/checks/errors/privacy/rust-pub-restricted-visitor.h b/gcc/rust/checks/errors/privacy/rust-pub-restricted-visitor.h
index c77c6d8..57061bc 100644
--- a/gcc/rust/checks/errors/privacy/rust-pub-restricted-visitor.h
+++ b/gcc/rust/checks/errors/privacy/rust-pub-restricted-visitor.h
@@ -87,7 +87,7 @@ public:
*
* @return true if the visibility restriction is valid, false otherwise.
*/
- bool is_restriction_valid (NodeId item_id, const Location &locus);
+ bool is_restriction_valid (NodeId item_id, const location_t locus);
virtual void visit (HIR::Module &mod);
virtual void visit (HIR::ExternCrate &crate);
diff --git a/gcc/rust/checks/errors/rust-feature-gate.cc b/gcc/rust/checks/errors/rust-feature-gate.cc
index 79007fd..37c0679 100644
--- a/gcc/rust/checks/errors/rust-feature-gate.cc
+++ b/gcc/rust/checks/errors/rust-feature-gate.cc
@@ -65,7 +65,7 @@ FeatureGate::check (AST::Crate &crate)
}
void
-FeatureGate::gate (Feature::Name name, Location loc,
+FeatureGate::gate (Feature::Name name, location_t loc,
const std::string &error_msg)
{
if (!valid_features.count (name))
diff --git a/gcc/rust/checks/errors/rust-feature-gate.h b/gcc/rust/checks/errors/rust-feature-gate.h
index 5ce0571..f06fd8c 100644
--- a/gcc/rust/checks/errors/rust-feature-gate.h
+++ b/gcc/rust/checks/errors/rust-feature-gate.h
@@ -186,7 +186,7 @@ public:
void visit (AST::BareFunctionType &type) override {}
private:
- void gate (Feature::Name name, Location loc, const std::string &error_msg);
+ void gate (Feature::Name name, location_t loc, const std::string &error_msg);
void check_rustc_attri (const std::vector<AST::Attribute> &attributes);
std::set<Feature::Name> valid_features;
};
diff --git a/gcc/rust/expand/rust-proc-macro.cc b/gcc/rust/expand/rust-proc-macro.cc
index 69de989..e9e7918 100644
--- a/gcc/rust/expand/rust-proc-macro.cc
+++ b/gcc/rust/expand/rust-proc-macro.cc
@@ -89,7 +89,7 @@ register_callback (void *handle, Symbol, std::string symbol_name,
void *addr = dlsym (handle, symbol_name.c_str ());
if (addr == nullptr)
{
- rust_error_at (Location (),
+ rust_error_at (UNDEF_LOCATION,
"Callback registration symbol (%s) missing from "
"proc macro, wrong version?",
symbol_name.c_str ());
diff --git a/gcc/rust/metadata/rust-imports.h b/gcc/rust/metadata/rust-imports.h
index 71d2ff8..a497c67 100644
--- a/gcc/rust/metadata/rust-imports.h
+++ b/gcc/rust/metadata/rust-imports.h
@@ -76,7 +76,7 @@ public:
// Given an error if the next LENGTH bytes do not match BYTES.
// Advance the read position by LENGTH.
- void require_bytes (Location, const char *bytes, size_t length);
+ void require_bytes (location_t, const char *bytes, size_t length);
// Advance the read position by SKIP bytes.
void advance (size_t skip)
@@ -115,7 +115,7 @@ public:
const std::string &relative_import_path);
static std::pair<std::unique_ptr<Stream>, std::vector<ProcMacro::Procmacro>>
- try_package_in_directory (const std::string &, Location);
+ try_package_in_directory (const std::string &, location_t);
// Constructor.
Import (std::unique_ptr<Stream>, location_t);
diff --git a/gcc/rust/resolve/rust-ast-resolve-path.h b/gcc/rust/resolve/rust-ast-resolve-path.h
index c6d2e1a..0f3af46 100644
--- a/gcc/rust/resolve/rust-ast-resolve-path.h
+++ b/gcc/rust/resolve/rust-ast-resolve-path.h
@@ -43,7 +43,7 @@ private:
void
resolve_simple_path_segments (CanonicalPath prefix, size_t offs,
const std::vector<AST::SimplePathSegment> &segs,
- NodeId expr_node_id, Location expr_locus);
+ NodeId expr_node_id, location_t expr_locus);
};
} // namespace Resolver
diff --git a/gcc/rust/resolve/rust-name-resolver.h b/gcc/rust/resolve/rust-name-resolver.h
index e295c65..67a1d28 100644
--- a/gcc/rust/resolve/rust-name-resolver.h
+++ b/gcc/rust/resolve/rust-name-resolver.h
@@ -71,14 +71,14 @@ public:
CrateNum get_crate_num () const { return crate_num; }
NodeId get_node_id () const { return node_id; }
- std::map<NodeId, Location> &get_declarations () { return decls_within_rib; }
+ std::map<NodeId, location_t> &get_declarations () { return decls_within_rib; }
private:
CrateNum crate_num;
NodeId node_id;
std::map<CanonicalPath, NodeId> path_mappings;
std::map<NodeId, CanonicalPath> reverse_path_mappings;
- std::map<NodeId, Location> decls_within_rib;
+ std::map<NodeId, location_t> decls_within_rib;
std::map<NodeId, std::set<NodeId>> references;
std::map<NodeId, ItemType> decl_type_mappings;
};
diff --git a/gcc/rust/rust-backend.h b/gcc/rust/rust-backend.h
index 03754f5..eff83e9 100644
--- a/gcc/rust/rust-backend.h
+++ b/gcc/rust/rust-backend.h
@@ -56,7 +56,7 @@ public:
{}
typed_identifier (const std::string &a_name, tree a_type,
- Location a_location)
+ location_t a_location)
: name (a_name), type (a_type), location (a_location)
{}
};
@@ -229,7 +229,7 @@ public:
// Supported values of OP are enumerated in ArithmeticOrLogicalOperator.
virtual tree arithmetic_or_logical_expression (ArithmeticOrLogicalOperator op,
tree left, tree right,
- Location loc)
+ location_t loc)
= 0;
// Return an expression for the operation LEFT OP RIGHT.
@@ -239,14 +239,14 @@ public:
// variable which will contain the result of that operation.
virtual tree
arithmetic_or_logical_expression_checked (ArithmeticOrLogicalOperator op,
- tree left, tree right, Location loc,
- Bvariable *receiver)
+ tree left, tree right,
+ location_t loc, Bvariable *receiver)
= 0;
// Return an expression for the operation LEFT OP RIGHT.
// Supported values of OP are enumerated in ComparisonOperator.
virtual tree comparison_expression (ComparisonOperator op, tree left,
- tree right, Location loc)
+ tree right, location_t loc)
= 0;
// Return an expression for the operation LEFT OP RIGHT.
@@ -340,7 +340,7 @@ public:
// The statements will be added after the block is created.
virtual tree block (tree function, tree enclosing,
const std::vector<Bvariable *> &vars,
- Location start_location, Location end_location)
+ location_t start_location, location_t end_location)
= 0;
// Add the statements to a block. The block is created first. Then
diff --git a/gcc/rust/rust-diagnostics.h b/gcc/rust/rust-diagnostics.h
index c95fd08..a544645 100644
--- a/gcc/rust/rust-diagnostics.h
+++ b/gcc/rust/rust-diagnostics.h
@@ -1090,24 +1090,24 @@ TABLE_TO_MAP(E0794),
};
extern void
-rust_internal_error_at (const Location, const char *fmt, ...)
+rust_internal_error_at (const location_t, const char *fmt, ...)
RUST_ATTRIBUTE_GCC_DIAG (2, 3)
RUST_ATTRIBUTE_NORETURN;
extern void
-rust_error_at (const Location, const char *fmt, ...)
+rust_error_at (const location_t, const char *fmt, ...)
RUST_ATTRIBUTE_GCC_DIAG (2, 3);
extern void
-rust_error_at (const Location, const ErrorCode, const char *fmt, ...)
+rust_error_at (const location_t, const ErrorCode, const char *fmt, ...)
RUST_ATTRIBUTE_GCC_DIAG (3, 4);
extern void
-rust_warning_at (const Location, int opt, const char *fmt, ...)
+rust_warning_at (const location_t, int opt, const char *fmt, ...)
RUST_ATTRIBUTE_GCC_DIAG (3, 4);
extern void
-rust_fatal_error (const Location, const char *fmt, ...)
+rust_fatal_error (const location_t, const char *fmt, ...)
RUST_ATTRIBUTE_GCC_DIAG (2, 3)
RUST_ATTRIBUTE_NORETURN;
extern void
-rust_inform (const Location, const char *fmt, ...)
+rust_inform (const location_t, const char *fmt, ...)
RUST_ATTRIBUTE_GCC_DIAG (2, 3);
// rich locations
@@ -1135,12 +1135,12 @@ rust_close_quote ();
// clang-format off
extern void
-rust_be_internal_error_at (const Location, const std::string &errmsg)
+rust_be_internal_error_at (const location_t, const std::string &errmsg)
RUST_ATTRIBUTE_NORETURN;
extern void
-rust_be_error_at (const Location, const std::string &errmsg);
+rust_be_error_at (const location_t, const std::string &errmsg);
extern void
-rust_be_error_at (const Location, const ErrorCode,
+rust_be_error_at (const location_t, const ErrorCode,
const std::string &errmsg);
extern void
rust_be_error_at (const rich_location &, const std::string &errmsg);
@@ -1148,12 +1148,12 @@ extern void
rust_be_error_at (const rich_location &, const ErrorCode,
const std::string &errmsg);
extern void
-rust_be_warning_at (const Location, int opt, const std::string &warningmsg);
+rust_be_warning_at (const location_t, int opt, const std::string &warningmsg);
extern void
-rust_be_fatal_error (const Location, const std::string &errmsg)
+rust_be_fatal_error (const location_t, const std::string &errmsg)
RUST_ATTRIBUTE_NORETURN;
extern void
-rust_be_inform (const Location, const std::string &infomsg);
+rust_be_inform (const location_t, const std::string &infomsg);
extern void
rust_be_get_quotechars (const char **open_quote, const char **close_quote);
extern bool
diff --git a/gcc/rust/rust-gcc.cc b/gcc/rust/rust-gcc.cc
index ebdc6be..a947df7 100644
--- a/gcc/rust/rust-gcc.cc
+++ b/gcc/rust/rust-gcc.cc
@@ -186,7 +186,8 @@ public:
tree arithmetic_or_logical_expression_checked (ArithmeticOrLogicalOperator op,
tree left, tree right,
- Location, Bvariable *receiver);
+ location_t,
+ Bvariable *receiver);
tree comparison_expression (ComparisonOperator op, tree left, tree right,
location_t);
@@ -231,7 +232,7 @@ public:
// Blocks.
- tree block (tree, tree, const std::vector<Bvariable *> &, Location,
+ tree block (tree, tree, const std::vector<Bvariable *> &, location_t,
location_t);
void block_add_statements (tree, const std::vector<tree> &);
@@ -255,7 +256,7 @@ public:
Bvariable *static_chain_variable (tree, const std::string &, tree,
location_t);
- Bvariable *temporary_variable (tree, tree, tree, tree, bool, Location,
+ Bvariable *temporary_variable (tree, tree, tree, tree, bool, location_t,
tree *);
// Labels.
@@ -783,7 +784,7 @@ Gcc_backend::function_type_varadic (
tree
Gcc_backend::function_ptr_type (tree result_type,
const std::vector<tree> &parameters,
- Location /* locus */)
+ location_t /* locus */)
{
tree args = NULL_TREE;
tree *pp = &args;
@@ -2084,7 +2085,7 @@ Gcc_backend::statement_list (const std::vector<tree> &statements)
tree
Gcc_backend::block (tree fndecl, tree enclosing,
const std::vector<Bvariable *> &vars,
- Location start_location, location_t)
+ location_t start_location, location_t)
{
tree block_tree = make_node (BLOCK);
if (enclosing == NULL)
diff --git a/gcc/rust/rust-linemap.h b/gcc/rust/rust-linemap.h
index 6515bec..f8ca5b7 100644
--- a/gcc/rust/rust-linemap.h
+++ b/gcc/rust/rust-linemap.h
@@ -63,7 +63,7 @@ public:
// Produce a human-readable description of a Location, e.g.
// "foo.rust:10". Returns an empty string for predeclared, builtin or
// unknown locations.
- static std::string location_to_string (Location loc);
+ static std::string location_to_string (location_t loc);
private:
// Whether we are currently reading a file.
diff --git a/gcc/rust/rust-location.h b/gcc/rust/rust-location.h
index cd7f009..20a5be7 100644
--- a/gcc/rust/rust-location.h
+++ b/gcc/rust/rust-location.h
@@ -28,6 +28,4 @@
// Used to replace Location default constructor
#define UNDEF_LOCATION UNKNOWN_LOCATION
-typedef location_t Location;
-
#endif // !defined(RUST_LOCATION_H)
diff --git a/gcc/rust/util/rust-attributes.cc b/gcc/rust/util/rust-attributes.cc
index d4182edf..fcab920 100644
--- a/gcc/rust/util/rust-attributes.cc
+++ b/gcc/rust/util/rust-attributes.cc
@@ -122,7 +122,7 @@ is_builtin (const AST::Attribute &attribute, BuiltinAttrDefinition &builtin)
* characters.
*/
static void
-check_doc_alias (const std::string &alias_input, const Location &locus)
+check_doc_alias (const std::string &alias_input, const location_t locus)
{
// FIXME: The locus here is for the whole attribute. Can we get the locus
// of the alias input instead?
diff --git a/gcc/rust/util/rust-hir-map.cc b/gcc/rust/util/rust-hir-map.cc
index 2885fff..03d43fe 100644
--- a/gcc/rust/util/rust-hir-map.cc
+++ b/gcc/rust/util/rust-hir-map.cc
@@ -797,7 +797,7 @@ Mappings::insert_location (HirId id, location_t locus)
locations[id] = locus;
}
-Location
+location_t
Mappings::lookup_location (HirId id)
{
auto it = locations.find (id);
diff --git a/gcc/rust/util/rust-hir-map.h b/gcc/rust/util/rust-hir-map.h
index e2d4b7b..e1f6106 100644
--- a/gcc/rust/util/rust-hir-map.h
+++ b/gcc/rust/util/rust-hir-map.h
@@ -172,7 +172,7 @@ public:
bool lookup_hir_to_node (HirId id, NodeId *ref);
void insert_location (HirId id, location_t locus);
- Location lookup_location (HirId id);
+ location_t lookup_location (HirId id);
bool resolve_nodeid_to_stmt (NodeId id, HIR::Stmt **stmt);
@@ -383,7 +383,7 @@ private:
std::map<HirId, HIR::Pattern *> hirPatternMappings;
std::map<RustLangItem::ItemType, DefId> lang_item_mappings;
std::map<NodeId, const Resolver::CanonicalPath> paths;
- std::map<NodeId, Location> locations;
+ std::map<NodeId, location_t> locations;
std::map<NodeId, HirId> nodeIdToHirMappings;
std::map<HirId, NodeId> hirIdToNodeMappings;
diff --git a/gcc/rust/util/rust-token-converter.cc b/gcc/rust/util/rust-token-converter.cc
index e0794f38..d9fb85c 100644
--- a/gcc/rust/util/rust-token-converter.cc
+++ b/gcc/rust/util/rust-token-converter.cc
@@ -57,7 +57,7 @@ convert (location_t location)
return ProcMacro::Span::make_span (location, 0);
}
-static Location
+static location_t
convert (ProcMacro::Span span)
{
return span.start;