Lines Matching defs:Buf
62 static Expected<bool> parseMagic(StringRef &Buf) {
63 if (!Buf.consume_front(remarks::Magic))
66 if (Buf.size() < 1 || !Buf.consume_front(StringRef("\0", 1)))
72 static Expected<uint64_t> parseVersion(StringRef &Buf) {
73 if (Buf.size() < sizeof(uint64_t))
78 support::endian::read<uint64_t, llvm::endianness::little>(Buf.data());
84 Buf = Buf.drop_front(sizeof(uint64_t));
88 static Expected<uint64_t> parseStrTabSize(StringRef &Buf) {
89 if (Buf.size() < sizeof(uint64_t))
93 support::endian::read<uint64_t, llvm::endianness::little>(Buf.data());
94 Buf = Buf.drop_front(sizeof(uint64_t));
98 static Expected<ParsedStringTable> parseStrTab(StringRef &Buf,
100 if (Buf.size() < StrTabSize)
105 ParsedStringTable Result(StringRef(Buf.data(), StrTabSize));
106 Buf = Buf.drop_front(StrTabSize);
111 StringRef Buf, std::optional<ParsedStringTable> StrTab,
114 Expected<bool> isMeta = parseMagic(Buf);
120 Expected<uint64_t> Version = parseVersion(Buf);
124 Expected<uint64_t> StrTabSize = parseStrTabSize(Buf);
133 Expected<ParsedStringTable> MaybeStrTab = parseStrTab(Buf, *StrTabSize);
139 if (!Buf.starts_with("---")) {
140 // At this point, we expect Buf to contain the external file path.
141 StringRef ExternalFilePath = Buf;
155 Buf = SeparateBuf->getBuffer();
161 ? std::make_unique<YAMLStrTabRemarkParser>(Buf, std::move(*StrTab))
162 : std::make_unique<YAMLRemarkParser>(Buf);
168 YAMLRemarkParser::YAMLRemarkParser(StringRef Buf)
169 : YAMLRemarkParser(Buf, std::nullopt) {}
171 YAMLRemarkParser::YAMLRemarkParser(StringRef Buf,
174 SM(setupSM(LastErrorMessage)), Stream(Buf, SM), YAMLIt(Stream.begin()) {}