Lines Matching +full:node +full:- +full:version
1 //===- YAMLRemarkParser.cpp -----------------------------------------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
12 //===----------------------------------------------------------------------===//
27 assert(Ctx && "Expected non-null Ctx in diagnostic handler."); in handleDiagnostic()
38 yaml::Stream &Stream, yaml::Node &Node) { in YAMLParseError() argument
41 // 2) Use the stream to print the error with the associated node. in YAMLParseError()
49 Stream.printError(&Node, Twine(Msg) + Twine('\n')); in YAMLParseError()
75 "Expecting version number."); in parseVersion()
77 uint64_t Version = in parseVersion() local
79 if (Version != remarks::CurrentRemarkVersion) in parseVersion()
81 "Mismatching remark version. Got %" PRId64 in parseVersion()
83 Version, remarks::CurrentRemarkVersion); in parseVersion()
85 return Version; in parseVersion()
120 Expected<uint64_t> Version = parseVersion(Buf); in createYAMLParserFromMeta() local
121 if (!Version) in createYAMLParserFromMeta()
122 return Version.takeError(); in createYAMLParserFromMeta()
138 // If it starts with "---", there is no external file. in createYAMLParserFromMeta()
139 if (!Buf.starts_with("---")) { in createYAMLParserFromMeta()
155 Buf = SeparateBuf->getBuffer(); in createYAMLParserFromMeta()
164 Result->SeparateBuf = std::move(SeparateBuf); in createYAMLParserFromMeta()
176 Error YAMLRemarkParser::error(StringRef Message, yaml::Node &Node) { in error() argument
177 return make_error<YAMLParseError>(Message, SM, Stream, Node); in error()
193 yaml::Node *YAMLRoot = RemarkEntry.getRoot(); in parseRemark()
207 // key-value stream. in parseRemark()
251 for (yaml::Node &Arg : *Args) { in parseRemark()
271 Expected<Type> YAMLRemarkParser::parseType(yaml::MappingNode &Node) { in parseType() argument
272 auto Type = StringSwitch<remarks::Type>(Node.getRawTag()) in parseType()
281 return error("expected a remark tag.", Node); in parseType()
285 Expected<StringRef> YAMLRemarkParser::parseKey(yaml::KeyValueNode &Node) { in parseKey() argument
286 if (auto *Key = dyn_cast<yaml::ScalarNode>(Node.getKey())) in parseKey()
287 return Key->getRawValue(); in parseKey()
289 return error("key is not a string.", Node); in parseKey()
292 Expected<StringRef> YAMLRemarkParser::parseStr(yaml::KeyValueNode &Node) { in parseStr() argument
293 auto *Value = dyn_cast<yaml::ScalarNode>(Node.getValue()); in parseStr()
297 // Try to parse the value as a block node. in parseStr()
298 ValueBlock = dyn_cast<yaml::BlockScalarNode>(Node.getValue()); in parseStr()
300 return error("expected a value of scalar type.", Node); in parseStr()
301 Result = ValueBlock->getValue(); in parseStr()
303 Result = Value->getRawValue(); in parseStr()
311 Expected<unsigned> YAMLRemarkParser::parseUnsigned(yaml::KeyValueNode &Node) { in parseUnsigned() argument
313 auto *Value = dyn_cast<yaml::ScalarNode>(Node.getValue()); in parseUnsigned()
315 return error("expected a value of scalar type.", Node); in parseUnsigned()
317 if (Value->getValue(Tmp).getAsInteger(10, UnsignedValue)) in parseUnsigned()
323 YAMLRemarkParser::parseDebugLoc(yaml::KeyValueNode &Node) { in parseDebugLoc() argument
324 auto *DebugLoc = dyn_cast<yaml::MappingNode>(Node.getValue()); in parseDebugLoc()
326 return error("expected a value of mapping type.", Node); in parseDebugLoc()
360 return error("DebugLoc node incomplete.", Node); in parseDebugLoc()
365 Expected<Argument> YAMLRemarkParser::parseArg(yaml::Node &Node) { in parseArg() argument
366 auto *ArgMap = dyn_cast<yaml::MappingNode>(&Node); in parseArg()
368 return error("expected a value of mapping type.", Node); in parseArg()
432 Expected<StringRef> YAMLStrTabRemarkParser::parseStr(yaml::KeyValueNode &Node) { in parseStr() argument
433 auto *Value = dyn_cast<yaml::ScalarNode>(Node.getValue()); in parseStr()
437 // Try to parse the value as a block node. in parseStr()
438 ValueBlock = dyn_cast<yaml::BlockScalarNode>(Node.getValue()); in parseStr()
440 return error("expected a value of scalar type.", Node); in parseStr()
441 Result = ValueBlock->getValue(); in parseStr()
443 Result = Value->getRawValue(); in parseStr()
446 if (Expected<unsigned> MaybeStrID = parseUnsigned(Node)) in parseStr()