diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
commit | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch) | |
tree | 64175d5cadab313b3e7039ebaa06c5bc3295e274 /contrib/libs/llvm12/lib/Support/YAMLTraits.cpp | |
parent | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff) | |
download | ydb-e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/llvm12/lib/Support/YAMLTraits.cpp')
-rw-r--r-- | contrib/libs/llvm12/lib/Support/YAMLTraits.cpp | 108 |
1 files changed, 54 insertions, 54 deletions
diff --git a/contrib/libs/llvm12/lib/Support/YAMLTraits.cpp b/contrib/libs/llvm12/lib/Support/YAMLTraits.cpp index a84e4f57d1..aa6163a761 100644 --- a/contrib/libs/llvm12/lib/Support/YAMLTraits.cpp +++ b/contrib/libs/llvm12/lib/Support/YAMLTraits.cpp @@ -48,10 +48,10 @@ void IO::setContext(void *Context) { Ctxt = Context; } -void IO::setAllowUnknownKeys(bool Allow) { - llvm_unreachable("Only supported for Input"); -} - +void IO::setAllowUnknownKeys(bool Allow) { + llvm_unreachable("Only supported for Input"); +} + //===----------------------------------------------------------------------===// // Input //===----------------------------------------------------------------------===// @@ -175,7 +175,7 @@ bool Input::preflightKey(const char *Key, bool Required, bool, bool &UseDefault, return false; } MN->ValidKeys.push_back(Key); - HNode *Value = MN->Mapping[Key].first.get(); + HNode *Value = MN->Mapping[Key].first.get(); if (!Value) { if (Required) setError(CurrentNode, Twine("missing required key '") + Key + "'"); @@ -201,12 +201,12 @@ void Input::endMapping() { return; for (const auto &NN : MN->Mapping) { if (!is_contained(MN->ValidKeys, NN.first())) { - const SMRange &ReportLoc = NN.second.second; - if (!AllowUnknownKeys) { - setError(ReportLoc, Twine("unknown key '") + NN.first() + "'"); - break; - } else - reportWarning(ReportLoc, Twine("unknown key '") + NN.first() + "'"); + const SMRange &ReportLoc = NN.second.second; + if (!AllowUnknownKeys) { + setError(ReportLoc, Twine("unknown key '") + NN.first() + "'"); + break; + } else + reportWarning(ReportLoc, Twine("unknown key '") + NN.first() + "'"); } } } @@ -378,24 +378,24 @@ void Input::setError(Node *node, const Twine &message) { EC = make_error_code(errc::invalid_argument); } -void Input::setError(const SMRange &range, const Twine &message) { - Strm->printError(range, message); - EC = make_error_code(errc::invalid_argument); -} - -void Input::reportWarning(HNode *hnode, const Twine &message) { - assert(hnode && "HNode must not be NULL"); - Strm->printError(hnode->_node, message, SourceMgr::DK_Warning); -} - -void Input::reportWarning(Node *node, const Twine &message) { - Strm->printError(node, message, SourceMgr::DK_Warning); -} - -void Input::reportWarning(const SMRange &range, const Twine &message) { - Strm->printError(range, message, SourceMgr::DK_Warning); -} - +void Input::setError(const SMRange &range, const Twine &message) { + Strm->printError(range, message); + EC = make_error_code(errc::invalid_argument); +} + +void Input::reportWarning(HNode *hnode, const Twine &message) { + assert(hnode && "HNode must not be NULL"); + Strm->printError(hnode->_node, message, SourceMgr::DK_Warning); +} + +void Input::reportWarning(Node *node, const Twine &message) { + Strm->printError(node, message, SourceMgr::DK_Warning); +} + +void Input::reportWarning(const SMRange &range, const Twine &message) { + Strm->printError(range, message, SourceMgr::DK_Warning); +} + std::unique_ptr<Input::HNode> Input::createHNodes(Node *N) { SmallString<128> StringStorage; if (ScalarNode *SN = dyn_cast<ScalarNode>(N)) { @@ -439,8 +439,8 @@ std::unique_ptr<Input::HNode> Input::createHNodes(Node *N) { auto ValueHNode = createHNodes(Value); if (EC) break; - mapHNode->Mapping[KeyStr] = - std::make_pair(std::move(ValueHNode), KeyNode->getSourceRange()); + mapHNode->Mapping[KeyStr] = + std::make_pair(std::move(ValueHNode), KeyNode->getSourceRange()); } return std::move(mapHNode); } else if (isa<NullNode>(N)) { @@ -455,8 +455,8 @@ void Input::setError(const Twine &Message) { setError(CurrentNode, Message); } -void Input::setAllowUnknownKeys(bool Allow) { AllowUnknownKeys = Allow; } - +void Input::setAllowUnknownKeys(bool Allow) { AllowUnknownKeys = Allow; } + bool Input::canElideEmptySequence() { return false; } @@ -592,7 +592,7 @@ void Output::endSequence() { // If we did not emit anything, we should explicitly emit an empty sequence if (StateStack.back() == inSeqFirstElement) { Padding = PaddingBeforeContainer; - newLineCheck(/*EmptySequence=*/true); + newLineCheck(/*EmptySequence=*/true); output("[]"); Padding = "\n"; } @@ -798,7 +798,7 @@ void Output::outputNewLine() { // if seq in middle, use "- " if firstKey, else use " " // -void Output::newLineCheck(bool EmptySequence) { +void Output::newLineCheck(bool EmptySequence) { if (Padding != "\n") { output(Padding); Padding = {}; @@ -807,7 +807,7 @@ void Output::newLineCheck(bool EmptySequence) { outputNewLine(); Padding = {}; - if (StateStack.size() == 0 || EmptySequence) + if (StateStack.size() == 0 || EmptySequence) return; unsigned Indent = StateStack.size() - 1; @@ -884,8 +884,8 @@ void ScalarTraits<bool>::output(const bool &Val, void *, raw_ostream &Out) { } StringRef ScalarTraits<bool>::input(StringRef Scalar, void *, bool &Val) { - if (llvm::Optional<bool> Parsed = parseBool(Scalar)) { - Val = *Parsed; + if (llvm::Optional<bool> Parsed = parseBool(Scalar)) { + Val = *Parsed; return StringRef(); } return "invalid boolean"; @@ -1056,7 +1056,7 @@ StringRef ScalarTraits<float>::input(StringRef Scalar, void *, float &Val) { } void ScalarTraits<Hex8>::output(const Hex8 &Val, void *, raw_ostream &Out) { - Out << format("0x%" PRIX8, (uint8_t)Val); + Out << format("0x%" PRIX8, (uint8_t)Val); } StringRef ScalarTraits<Hex8>::input(StringRef Scalar, void *, Hex8 &Val) { @@ -1070,7 +1070,7 @@ StringRef ScalarTraits<Hex8>::input(StringRef Scalar, void *, Hex8 &Val) { } void ScalarTraits<Hex16>::output(const Hex16 &Val, void *, raw_ostream &Out) { - Out << format("0x%" PRIX16, (uint16_t)Val); + Out << format("0x%" PRIX16, (uint16_t)Val); } StringRef ScalarTraits<Hex16>::input(StringRef Scalar, void *, Hex16 &Val) { @@ -1084,7 +1084,7 @@ StringRef ScalarTraits<Hex16>::input(StringRef Scalar, void *, Hex16 &Val) { } void ScalarTraits<Hex32>::output(const Hex32 &Val, void *, raw_ostream &Out) { - Out << format("0x%" PRIX32, (uint32_t)Val); + Out << format("0x%" PRIX32, (uint32_t)Val); } StringRef ScalarTraits<Hex32>::input(StringRef Scalar, void *, Hex32 &Val) { @@ -1098,7 +1098,7 @@ StringRef ScalarTraits<Hex32>::input(StringRef Scalar, void *, Hex32 &Val) { } void ScalarTraits<Hex64>::output(const Hex64 &Val, void *, raw_ostream &Out) { - Out << format("0x%" PRIX64, (uint64_t)Val); + Out << format("0x%" PRIX64, (uint64_t)Val); } StringRef ScalarTraits<Hex64>::input(StringRef Scalar, void *, Hex64 &Val) { @@ -1108,15 +1108,15 @@ StringRef ScalarTraits<Hex64>::input(StringRef Scalar, void *, Hex64 &Val) { Val = Num; return StringRef(); } - -void ScalarTraits<VersionTuple>::output(const VersionTuple &Val, void *, - llvm::raw_ostream &Out) { - Out << Val.getAsString(); -} - -StringRef ScalarTraits<VersionTuple>::input(StringRef Scalar, void *, - VersionTuple &Val) { - if (Val.tryParse(Scalar)) - return "invalid version format"; - return StringRef(); -} + +void ScalarTraits<VersionTuple>::output(const VersionTuple &Val, void *, + llvm::raw_ostream &Out) { + Out << Val.getAsString(); +} + +StringRef ScalarTraits<VersionTuple>::input(StringRef Scalar, void *, + VersionTuple &Val) { + if (Val.tryParse(Scalar)) + return "invalid version format"; + return StringRef(); +} |