@@ -242,9 +242,7 @@ Error Path::Root::getError() const {
242242 return createStringError (llvm::inconvertibleErrorCode (), OS.str ());
243243}
244244
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) {
248246 std::vector<const Object::value_type *> Elements;
249247 for (const auto &E : O)
250248 Elements.push_back (&E);
@@ -258,7 +256,7 @@ std::vector<const Object::value_type *> sortedElements(const Object &O) {
258256// Prints a one-line version of a value that isn't our main focus.
259257// We interleave writes to OS and JOS, exploiting the lack of extra buffering.
260258// 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) {
262260 switch (V.kind ()) {
263261 case Value::Array:
264262 JOS.rawValue (V.getAsArray ()->empty () ? " []" : " [ ... ]" );
@@ -284,7 +282,7 @@ void abbreviate(const Value &V, OStream &JOS) {
284282
285283// Prints a semi-expanded version of a value that is our main focus.
286284// 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) {
288286 switch (V.kind ()) {
289287 case Value::Array:
290288 JOS.array ([&] {
@@ -306,8 +304,6 @@ void abbreviateChildren(const Value &V, OStream &JOS) {
306304 }
307305}
308306
309- } // namespace
310-
311307void Path::Root::printErrorContext (const Value &R, raw_ostream &OS) const {
312308 OStream JOS (OS, /* IndentSize=*/ 2 );
313309 // PrintValue recurses down the path, printing the ancestors of our target.
@@ -414,6 +410,7 @@ class Parser {
414410 std::optional<Error> Err;
415411 const char *Start, *P, *End;
416412};
413+ } // namespace
417414
418415bool Parser::parseValue (Value &Out) {
419416 eatWhitespace ();
@@ -681,7 +678,6 @@ bool Parser::parseError(const char *Msg) {
681678 std::make_unique<ParseError>(Msg, Line, P - StartOfLine, P - Start));
682679 return false ;
683680}
684- } // namespace
685681
686682Expected<Value> parse (StringRef JSON) {
687683 Parser P (JSON);
0 commit comments