@@ -242,9 +242,7 @@ Error Path::Root::getError() const {
242
242
return createStringError (llvm::inconvertibleErrorCode (), OS.str ());
243
243
}
244
244
245
- namespace {
246
-
247
- std::vector<const Object::value_type *> sortedElements (const Object &O) {
245
+ static std::vector<const Object::value_type *> sortedElements (const Object &O) {
248
246
std::vector<const Object::value_type *> Elements;
249
247
for (const auto &E : O)
250
248
Elements.push_back (&E);
@@ -258,7 +256,7 @@ std::vector<const Object::value_type *> sortedElements(const Object &O) {
258
256
// Prints a one-line version of a value that isn't our main focus.
259
257
// We interleave writes to OS and JOS, exploiting the lack of extra buffering.
260
258
// This is OK as we own the implementation.
261
- void abbreviate (const Value &V, OStream &JOS) {
259
+ static void abbreviate (const Value &V, OStream &JOS) {
262
260
switch (V.kind ()) {
263
261
case Value::Array:
264
262
JOS.rawValue (V.getAsArray ()->empty () ? " []" : " [ ... ]" );
@@ -284,7 +282,7 @@ void abbreviate(const Value &V, OStream &JOS) {
284
282
285
283
// Prints a semi-expanded version of a value that is our main focus.
286
284
// Array/Object entries are printed, but not recursively as they may be huge.
287
- void abbreviateChildren (const Value &V, OStream &JOS) {
285
+ static void abbreviateChildren (const Value &V, OStream &JOS) {
288
286
switch (V.kind ()) {
289
287
case Value::Array:
290
288
JOS.array ([&] {
@@ -306,8 +304,6 @@ void abbreviateChildren(const Value &V, OStream &JOS) {
306
304
}
307
305
}
308
306
309
- } // namespace
310
-
311
307
void Path::Root::printErrorContext (const Value &R, raw_ostream &OS) const {
312
308
OStream JOS (OS, /* IndentSize=*/ 2 );
313
309
// PrintValue recurses down the path, printing the ancestors of our target.
@@ -414,6 +410,7 @@ class Parser {
414
410
std::optional<Error> Err;
415
411
const char *Start, *P, *End;
416
412
};
413
+ } // namespace
417
414
418
415
bool Parser::parseValue (Value &Out) {
419
416
eatWhitespace ();
@@ -681,7 +678,6 @@ bool Parser::parseError(const char *Msg) {
681
678
std::make_unique<ParseError>(Msg, Line, P - StartOfLine, P - Start));
682
679
return false ;
683
680
}
684
- } // namespace
685
681
686
682
Expected<Value> parse (StringRef JSON) {
687
683
Parser P (JSON);
0 commit comments