Skip to content

Commit 05abefd

Browse files
committed
[clang-doc] Use static functions over the anonymous namespace
1 parent a81102b commit 05abefd

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

clang-tools-extra/clang-doc/Representation.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,10 @@ llvm::StringRef commentKindToString(CommentKind Kind) {
8282
llvm_unreachable("Unhandled CommentKind");
8383
}
8484

85-
namespace {
86-
8785
const SymbolID EmptySID = SymbolID();
8886

8987
template <typename T>
90-
llvm::Expected<std::unique_ptr<Info>>
88+
static llvm::Expected<std::unique_ptr<Info>>
9189
reduce(std::vector<std::unique_ptr<Info>> &Values) {
9290
if (Values.empty() || !Values[0])
9391
return llvm::createStringError(llvm::inconvertibleErrorCode(),
@@ -102,7 +100,7 @@ reduce(std::vector<std::unique_ptr<Info>> &Values) {
102100
// Return the index of the matching child in the vector, or -1 if merge is not
103101
// necessary.
104102
template <typename T>
105-
int getChildIndexIfExists(std::vector<T> &Children, T &ChildToMerge) {
103+
static int getChildIndexIfExists(std::vector<T> &Children, T &ChildToMerge) {
106104
for (unsigned long I = 0; I < Children.size(); I++) {
107105
if (ChildToMerge.USR == Children[I].USR)
108106
return I;
@@ -111,8 +109,8 @@ int getChildIndexIfExists(std::vector<T> &Children, T &ChildToMerge) {
111109
}
112110

113111
template <typename T>
114-
void reduceChildren(std::vector<T> &Children,
115-
std::vector<T> &&ChildrenToMerge) {
112+
static void reduceChildren(std::vector<T> &Children,
113+
std::vector<T> &&ChildrenToMerge) {
116114
for (auto &ChildToMerge : ChildrenToMerge) {
117115
int MergeIdx = getChildIndexIfExists(Children, ChildToMerge);
118116
if (MergeIdx == -1) {
@@ -123,8 +121,6 @@ void reduceChildren(std::vector<T> &Children,
123121
}
124122
}
125123

126-
} // namespace
127-
128124
// Dispatch function.
129125
llvm::Expected<std::unique_ptr<Info>>
130126
mergeInfos(std::vector<std::unique_ptr<Info>> &Values) {

0 commit comments

Comments
 (0)