Skip to content

Commit fd0f62f

Browse files
authored
Make currently publicly unused member functions private. (#5679)
Rename them to `Impl` to avoid splitting an overload set across different access levels.
1 parent 1a7c1a1 commit fd0f62f

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

toolchain/sem_ir/diagnostic_loc_converter.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ auto DiagnosticLocConverter::ConvertWithImports(LocId loc_id,
1414
auto final_node_id = absolute_node_ids.pop_back_val();
1515

1616
// Convert the final location.
17-
LocAndImports result = {.loc = Convert(final_node_id, token_only)};
17+
LocAndImports result = {.loc = ConvertImpl(final_node_id, token_only)};
1818

1919
// Convert the import locations.
2020
for (const auto& absolute_node_id : absolute_node_ids) {
@@ -23,7 +23,7 @@ auto DiagnosticLocConverter::ConvertWithImports(LocId loc_id,
2323
// we don't have a location.
2424
continue;
2525
}
26-
result.imports.push_back({.loc = Convert(absolute_node_id, false).loc});
26+
result.imports.push_back({.loc = ConvertImpl(absolute_node_id, false).loc});
2727
}
2828

2929
return result;
@@ -33,32 +33,32 @@ auto DiagnosticLocConverter::Convert(LocId loc_id, bool token_only) const
3333
-> Diagnostics::ConvertedLoc {
3434
llvm::SmallVector<SemIR::AbsoluteNodeId> absolute_node_ids =
3535
SemIR::GetAbsoluteNodeId(sem_ir_, loc_id);
36-
return Convert(absolute_node_ids.back(), token_only);
36+
return ConvertImpl(absolute_node_ids.back(), token_only);
3737
}
3838

39-
auto DiagnosticLocConverter::Convert(SemIR::AbsoluteNodeId absolute_node_id,
40-
bool token_only) const
39+
auto DiagnosticLocConverter::ConvertImpl(SemIR::AbsoluteNodeId absolute_node_id,
40+
bool token_only) const
4141
-> Diagnostics::ConvertedLoc {
4242
if (absolute_node_id.check_ir_id() == SemIR::CheckIRId::Cpp) {
43-
return Convert(absolute_node_id.clang_source_loc_id());
43+
return ConvertImpl(absolute_node_id.clang_source_loc_id());
4444
}
4545

46-
return Convert(absolute_node_id.check_ir_id(), absolute_node_id.node_id(),
47-
token_only);
46+
return ConvertImpl(absolute_node_id.check_ir_id(), absolute_node_id.node_id(),
47+
token_only);
4848
}
4949

50-
auto DiagnosticLocConverter::Convert(SemIR::CheckIRId check_ir_id,
51-
Parse::NodeId node_id,
52-
bool token_only) const
50+
auto DiagnosticLocConverter::ConvertImpl(SemIR::CheckIRId check_ir_id,
51+
Parse::NodeId node_id,
52+
bool token_only) const
5353
-> Diagnostics::ConvertedLoc {
5454
CARBON_CHECK(check_ir_id != SemIR::CheckIRId::Cpp);
5555
const auto& tree_and_subtrees =
5656
tree_and_subtrees_getters_[check_ir_id.index]();
5757
return tree_and_subtrees.NodeToDiagnosticLoc(node_id, token_only);
5858
}
5959

60-
auto DiagnosticLocConverter::Convert(ClangSourceLocId clang_source_loc_id) const
61-
-> Diagnostics::ConvertedLoc {
60+
auto DiagnosticLocConverter::ConvertImpl(
61+
ClangSourceLocId clang_source_loc_id) const -> Diagnostics::ConvertedLoc {
6262
clang::SourceLocation clang_loc =
6363
sem_ir_->clang_source_locs().Get(clang_source_loc_id);
6464

toolchain/sem_ir/diagnostic_loc_converter.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,21 @@ class DiagnosticLocConverter {
5050
auto Convert(LocId loc_id, bool token_only) const
5151
-> Diagnostics::ConvertedLoc;
5252

53+
private:
5354
// Converts an `absolute_node_id` in either a Carbon file or C++ import to a
5455
// diagnostic location.
55-
auto Convert(AbsoluteNodeId absolute_node_id, bool token_only) const
56+
auto ConvertImpl(AbsoluteNodeId absolute_node_id, bool token_only) const
5657
-> Diagnostics::ConvertedLoc;
5758

5859
// Converts a `node_id` corresponding to a specific check IR to a diagnostic
5960
// location.
60-
auto Convert(CheckIRId check_ir_id, Parse::NodeId node_id,
61-
bool token_only) const -> Diagnostics::ConvertedLoc;
61+
auto ConvertImpl(CheckIRId check_ir_id, Parse::NodeId node_id,
62+
bool token_only) const -> Diagnostics::ConvertedLoc;
6263

6364
// Converts a location pointing into C++ code to a diagnostic location.
64-
auto Convert(ClangSourceLocId clang_source_loc_id) const
65+
auto ConvertImpl(ClangSourceLocId clang_source_loc_id) const
6566
-> Diagnostics::ConvertedLoc;
6667

67-
private:
6868
// Converters for each SemIR.
6969
llvm::ArrayRef<Parse::GetTreeAndSubtreesFn> tree_and_subtrees_getters_;
7070

0 commit comments

Comments
 (0)