gccrs: 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>
This commit is contained in:
parent
9cc353d75a
commit
886d56d0c5
20 changed files with 45 additions and 46 deletions
|
@ -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 ¶m);
|
||||
void visit (Attribute &attrib);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace Privacy {
|
|||
|
||||
bool
|
||||
PubRestrictedVisitor::is_restriction_valid (NodeId item_id,
|
||||
const Location &locus)
|
||||
const location_t locus)
|
||||
{
|
||||
ModuleVisibility visibility;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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 ());
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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> ¶meters,
|
||||
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)
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -29,6 +29,4 @@
|
|||
// Used to replace Location default constructor
|
||||
#define UNDEF_LOCATION UNKNOWN_LOCATION
|
||||
|
||||
typedef location_t Location;
|
||||
|
||||
#endif // !defined(RUST_LOCATION_H)
|
||||
|
|
|
@ -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?
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue