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);
// 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;
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
* @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
*/
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.
bool
PubRestrictedVisitor::is_restriction_valid (NodeId item_id,
- const Location &locus)
+ const location_t locus)
{
ModuleVisibility visibility;
*
* @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);
}
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))
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;
};
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 ());
// 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)
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);
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
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;
};
{}
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)
{}
};
// 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.
// 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.
// 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
};
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
// 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);
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
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);
// 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> &);
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.
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;
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)
// 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.
// Used to replace Location default constructor
#define UNDEF_LOCATION UNKNOWN_LOCATION
-typedef location_t Location;
-
#endif // !defined(RUST_LOCATION_H)
* 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?
locations[id] = locus;
}
-Location
+location_t
Mappings::lookup_location (HirId id)
{
auto it = locations.find (id);
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);
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;
return ProcMacro::Span::make_span (location, 0);
}
-static Location
+static location_t
convert (ProcMacro::Span span)
{
return span.start;