Skip to content

Commit 6114574

Browse files
powerboat9philberty
authored andcommitted
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>
1 parent 69f6bc9 commit 6114574

20 files changed

Lines changed: 45 additions & 46 deletions

gcc/rust/ast/rust-ast-collector.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ class TokenCollector : public ASTVisitor
160160
void visit (Visitable &v);
161161
void visit (LoopLabel &label);
162162

163-
void visit (Literal &lit, Location locus = UNDEF_LOCATION);
163+
void visit (Literal &lit, location_t locus = UNDEF_LOCATION);
164164

165165
void visit (FunctionParam &param);
166166
void visit (Attribute &attrib);

gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ is_child_module (Analysis::Mappings &mappings, NodeId parent,
112112
// FIXME: This function needs a lot of refactoring
113113
void
114114
PrivacyReporter::check_for_privacy_violation (const NodeId &use_id,
115-
const Location &locus)
115+
const location_t locus)
116116
{
117117
NodeId ref_node_id = UNKNOWN_NODEID;
118118

@@ -172,7 +172,7 @@ PrivacyReporter::check_for_privacy_violation (const NodeId &use_id,
172172
void
173173
PrivacyReporter::check_base_type_privacy (Analysis::NodeMapping &node_mappings,
174174
const TyTy::BaseType *ty,
175-
const Location &locus)
175+
const location_t locus)
176176
{
177177
// Avoids repeating commong argument such as `use_id` or `locus` since we're
178178
// doing a lot of recursive calls here

gcc/rust/checks/errors/privacy/rust-privacy-reporter.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class PrivacyReporter : public HIR::HIRExpressionVisitor,
5656
* @param locus Location of said expression/statement
5757
*/
5858
void check_for_privacy_violation (const NodeId &use_id,
59-
const Location &locus);
59+
const location_t locus);
6060

6161
/**
6262
* Internal function used by `check_type_privacy` when dealing with complex
@@ -65,7 +65,7 @@ types
6565
*/
6666
void check_base_type_privacy (Analysis::NodeMapping &node_mappings,
6767
const TyTy::BaseType *ty,
68-
const Location &locus);
68+
const location_t locus);
6969

7070
/**
7171
* Check the privacy of an explicit type.

gcc/rust/checks/errors/privacy/rust-pub-restricted-visitor.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace Privacy {
2525

2626
bool
2727
PubRestrictedVisitor::is_restriction_valid (NodeId item_id,
28-
const Location &locus)
28+
const location_t locus)
2929
{
3030
ModuleVisibility visibility;
3131

gcc/rust/checks/errors/privacy/rust-pub-restricted-visitor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class PubRestrictedVisitor : public HIR::HIRVisItemVisitor
8787
*
8888
* @return true if the visibility restriction is valid, false otherwise.
8989
*/
90-
bool is_restriction_valid (NodeId item_id, const Location &locus);
90+
bool is_restriction_valid (NodeId item_id, const location_t locus);
9191

9292
virtual void visit (HIR::Module &mod);
9393
virtual void visit (HIR::ExternCrate &crate);

gcc/rust/checks/errors/rust-feature-gate.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ FeatureGate::check (AST::Crate &crate)
6565
}
6666

6767
void
68-
FeatureGate::gate (Feature::Name name, Location loc,
68+
FeatureGate::gate (Feature::Name name, location_t loc,
6969
const std::string &error_msg)
7070
{
7171
if (!valid_features.count (name))

gcc/rust/checks/errors/rust-feature-gate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ class FeatureGate : public AST::ASTVisitor
186186
void visit (AST::BareFunctionType &type) override {}
187187

188188
private:
189-
void gate (Feature::Name name, Location loc, const std::string &error_msg);
189+
void gate (Feature::Name name, location_t loc, const std::string &error_msg);
190190
void check_rustc_attri (const std::vector<AST::Attribute> &attributes);
191191
std::set<Feature::Name> valid_features;
192192
};

gcc/rust/expand/rust-proc-macro.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ register_callback (void *handle, Symbol, std::string symbol_name,
8989
void *addr = dlsym (handle, symbol_name.c_str ());
9090
if (addr == nullptr)
9191
{
92-
rust_error_at (Location (),
92+
rust_error_at (UNDEF_LOCATION,
9393
"Callback registration symbol (%s) missing from "
9494
"proc macro, wrong version?",
9595
symbol_name.c_str ());

gcc/rust/metadata/rust-imports.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class Import
7676

7777
// Given an error if the next LENGTH bytes do not match BYTES.
7878
// Advance the read position by LENGTH.
79-
void require_bytes (Location, const char *bytes, size_t length);
79+
void require_bytes (location_t, const char *bytes, size_t length);
8080

8181
// Advance the read position by SKIP bytes.
8282
void advance (size_t skip)
@@ -115,7 +115,7 @@ class Import
115115
const std::string &relative_import_path);
116116

117117
static std::pair<std::unique_ptr<Stream>, std::vector<ProcMacro::Procmacro>>
118-
try_package_in_directory (const std::string &, Location);
118+
try_package_in_directory (const std::string &, location_t);
119119

120120
// Constructor.
121121
Import (std::unique_ptr<Stream>, location_t);

gcc/rust/resolve/rust-ast-resolve-path.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class ResolvePath : public ResolverBase
4343
void
4444
resolve_simple_path_segments (CanonicalPath prefix, size_t offs,
4545
const std::vector<AST::SimplePathSegment> &segs,
46-
NodeId expr_node_id, Location expr_locus);
46+
NodeId expr_node_id, location_t expr_locus);
4747
};
4848

4949
} // namespace Resolver

0 commit comments

Comments
 (0)