LLVM 22.0.0git
YAMLParser.h
Go to the documentation of this file.
1//===- YAMLParser.h - Simple YAML parser ------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This is a YAML 1.2 parser.
10//
11// See http://www.yaml.org/spec/1.2/spec.html for the full standard.
12//
13// This currently does not implement the following:
14// * Tag resolution.
15// * UTF-16.
16// * BOMs anywhere other than the first Unicode scalar value in the file.
17//
18// The most important class here is Stream. This represents a YAML stream with
19// 0, 1, or many documents.
20//
21// SourceMgr sm;
22// StringRef input = getInput();
23// yaml::Stream stream(input, sm);
24//
25// for (yaml::document_iterator di = stream.begin(), de = stream.end();
26// di != de; ++di) {
27// yaml::Node *n = di->getRoot();
28// if (n) {
29// // Do something with n...
30// } else {
31// break;
32// }
33// }
34//
35//===----------------------------------------------------------------------===//
36
37#ifndef LLVM_SUPPORT_YAMLPARSER_H
38#define LLVM_SUPPORT_YAMLPARSER_H
39
40#include "llvm/ADT/StringRef.h"
43#include "llvm/Support/SMLoc.h"
45#include <cassert>
46#include <cstddef>
47#include <iterator>
48#include <map>
49#include <memory>
50#include <optional>
51#include <string>
52#include <system_error>
53
54namespace llvm {
55
56class MemoryBufferRef;
57class raw_ostream;
58class Twine;
59
60namespace yaml {
61
62class Document;
64class Node;
65class Scanner;
66struct Token;
67
68/// Dump all the tokens in this stream to OS.
69/// \returns true if there was an error, false otherwise.
70LLVM_ABI bool dumpTokens(StringRef Input, raw_ostream &);
71
72/// Scans all tokens in input without outputting anything. This is used
73/// for benchmarking the tokenizer.
74/// \returns true if there was an error, false otherwise.
75LLVM_ABI bool scanTokens(StringRef Input);
76
77/// Escape \a Input for a double quoted scalar; if \p EscapePrintable
78/// is true, all UTF8 sequences will be escaped, if \p EscapePrintable is
79/// false, those UTF8 sequences encoding printable unicode scalars will not be
80/// escaped, but emitted verbatim.
81LLVM_ABI std::string escape(StringRef Input, bool EscapePrintable = true);
82
83/// Parse \p S as a bool according to https://yaml.org/type/bool.html.
84LLVM_ABI std::optional<bool> parseBool(StringRef S);
85
86/// This class represents a YAML stream potentially containing multiple
87/// documents.
88class Stream {
89public:
90 /// This keeps a reference to the string referenced by \p Input.
91 LLVM_ABI Stream(StringRef Input, SourceMgr &, bool ShowColors = true,
92 std::error_code *EC = nullptr);
93
95 bool ShowColors = true, std::error_code *EC = nullptr);
97
100 LLVM_ABI void skip();
101 LLVM_ABI bool failed();
102
103 bool validate() {
104 skip();
105 return !failed();
106 }
107
108 LLVM_ABI void printError(Node *N, const Twine &Msg,
110 LLVM_ABI void printError(const SMRange &Range, const Twine &Msg,
112
113private:
114 friend class Document;
115
116 std::unique_ptr<Scanner> scanner;
117 std::unique_ptr<Document> CurrentDoc;
118};
119
120/// Abstract base class for all Nodes.
122 virtual void anchor();
123
124public:
134
135 Node(unsigned int Type, std::unique_ptr<Document> &, StringRef Anchor,
136 StringRef Tag);
137
138 // It's not safe to copy YAML nodes; the document is streamed and the position
139 // is part of the state.
140 Node(const Node &) = delete;
141 void operator=(const Node &) = delete;
142
143 void *operator new(size_t Size, BumpPtrAllocator &Alloc,
144 size_t Alignment = 16) noexcept {
145 return Alloc.Allocate(Size, Alignment);
146 }
147
148 void operator delete(void *Ptr, BumpPtrAllocator &Alloc,
149 size_t Size) noexcept {
150 Alloc.Deallocate(Ptr, Size, 0);
151 }
152
153 void operator delete(void *) noexcept = delete;
154
155 /// Get the value of the anchor attached to this node. If it does not
156 /// have one, getAnchor().size() will be 0.
157 StringRef getAnchor() const { return Anchor; }
158
159 /// Get the tag as it was written in the document. This does not
160 /// perform tag resolution.
161 StringRef getRawTag() const { return Tag; }
162
163 /// Get the verbatium tag for a given Node. This performs tag resoluton
164 /// and substitution.
165 std::string getVerbatimTag() const;
166
169
170 // These functions forward to Document and Scanner.
171 Token &peekNext();
172 Token getNext();
173 Node *parseBlockNode();
174 BumpPtrAllocator &getAllocator();
175 void setError(const Twine &Message, Token &Location) const;
176 bool failed() const;
177
178 virtual void skip() {}
179
180 unsigned int getType() const { return TypeID; }
181
182protected:
183 std::unique_ptr<Document> &Doc;
185
186 ~Node() = default;
187
188private:
189 unsigned int TypeID;
190 StringRef Anchor;
191 /// The tag as typed in the document.
192 StringRef Tag;
193};
194
195/// A null value.
196///
197/// Example:
198/// !!null null
199class LLVM_ABI NullNode final : public Node {
200 void anchor() override;
201
202public:
203 NullNode(std::unique_ptr<Document> &D)
204 : Node(NK_Null, D, StringRef(), StringRef()) {}
205
206 static bool classof(const Node *N) { return N->getType() == NK_Null; }
207};
208
209/// A scalar node is an opaque datum that can be presented as a
210/// series of zero or more Unicode scalar values.
211///
212/// Example:
213/// Adena
214class LLVM_ABI ScalarNode final : public Node {
215 void anchor() override;
216
217public:
218 ScalarNode(std::unique_ptr<Document> &D, StringRef Anchor, StringRef Tag,
219 StringRef Val)
220 : Node(NK_Scalar, D, Anchor, Tag), Value(Val) {
221 SMLoc Start = SMLoc::getFromPointer(Val.begin());
222 SMLoc End = SMLoc::getFromPointer(Val.end());
223 SourceRange = SMRange(Start, End);
224 }
225
226 // Return Value without any escaping or folding or other fun YAML stuff. This
227 // is the exact bytes that are contained in the file (after conversion to
228 // utf8).
229 StringRef getRawValue() const { return Value; }
230
231 /// Gets the value of this node as a StringRef.
232 ///
233 /// \param Storage is used to store the content of the returned StringRef if
234 /// it requires any modification from how it appeared in the source.
235 /// This happens with escaped characters and multi-line literals.
236 StringRef getValue(SmallVectorImpl<char> &Storage) const;
237
238 static bool classof(const Node *N) {
239 return N->getType() == NK_Scalar;
240 }
241
242private:
244
245 StringRef getDoubleQuotedValue(StringRef UnquotedValue,
246 SmallVectorImpl<char> &Storage) const;
247
248 static StringRef getSingleQuotedValue(StringRef RawValue,
249 SmallVectorImpl<char> &Storage);
250
251 static StringRef getPlainValue(StringRef RawValue,
252 SmallVectorImpl<char> &Storage);
253};
254
255/// A block scalar node is an opaque datum that can be presented as a
256/// series of zero or more Unicode scalar values.
257///
258/// Example:
259/// |
260/// Hello
261/// World
262class LLVM_ABI BlockScalarNode final : public Node {
263 void anchor() override;
264
265public:
266 BlockScalarNode(std::unique_ptr<Document> &D, StringRef Anchor, StringRef Tag,
267 StringRef Value, StringRef RawVal)
268 : Node(NK_BlockScalar, D, Anchor, Tag), Value(Value) {
269 SMLoc Start = SMLoc::getFromPointer(RawVal.begin());
270 SMLoc End = SMLoc::getFromPointer(RawVal.end());
271 SourceRange = SMRange(Start, End);
272 }
273
274 /// Gets the value of this node as a StringRef.
275 StringRef getValue() const { return Value; }
276
277 static bool classof(const Node *N) {
278 return N->getType() == NK_BlockScalar;
279 }
280
281private:
283};
284
285/// A key and value pair. While not technically a Node under the YAML
286/// representation graph, it is easier to treat them this way.
287///
288/// TODO: Consider making this not a child of Node.
289///
290/// Example:
291/// Section: .text
292class LLVM_ABI KeyValueNode final : public Node {
293 void anchor() override;
294
295public:
296 KeyValueNode(std::unique_ptr<Document> &D)
298
299 /// Parse and return the key.
300 ///
301 /// This may be called multiple times.
302 ///
303 /// \returns The key, or nullptr if failed() == true.
304 Node *getKey();
305
306 /// Parse and return the value.
307 ///
308 /// This may be called multiple times.
309 ///
310 /// \returns The value, or nullptr if failed() == true.
311 Node *getValue();
312
313 void skip() override {
314 if (Node *Key = getKey()) {
315 Key->skip();
316 if (Node *Val = getValue())
317 Val->skip();
318 }
319 }
320
321 static bool classof(const Node *N) {
322 return N->getType() == NK_KeyValue;
323 }
324
325private:
326 Node *Key = nullptr;
327 Node *Value = nullptr;
328};
329
330/// This is an iterator abstraction over YAML collections shared by both
331/// sequences and maps.
332///
333/// BaseT must have a ValueT* member named CurrentEntry and a member function
334/// increment() which must set CurrentEntry to 0 to create an end iterator.
335template <class BaseT, class ValueT> class basic_collection_iterator {
336public:
337 using iterator_category = std::input_iterator_tag;
339 using difference_type = std::ptrdiff_t;
342
344 basic_collection_iterator(BaseT *B) : Base(B) {}
345
347 assert(Base && Base->CurrentEntry && "Attempted to access end iterator!");
348 return Base->CurrentEntry;
349 }
350
351 ValueT &operator*() const {
352 assert(Base && Base->CurrentEntry &&
353 "Attempted to dereference end iterator!");
354 return *Base->CurrentEntry;
355 }
356
357 operator ValueT *() const {
358 assert(Base && Base->CurrentEntry && "Attempted to access end iterator!");
359 return Base->CurrentEntry;
360 }
361
362 /// Note on EqualityComparable:
363 ///
364 /// The iterator is not re-entrant,
365 /// it is meant to be used for parsing YAML on-demand
366 /// Once iteration started - it can point only to one entry at a time
367 /// hence Base.CurrentEntry and Other.Base.CurrentEntry are equal
368 /// iff Base and Other.Base are equal.
370 if (Base && (Base == Other.Base)) {
371 assert((Base->CurrentEntry == Other.Base->CurrentEntry)
372 && "Equal Bases expected to point to equal Entries");
373 }
374
375 return Base == Other.Base;
376 }
377
379 return !(Base == Other.Base);
380 }
381
383 assert(Base && "Attempted to advance iterator past end!");
384 Base->increment();
385 // Create an end iterator.
386 if (!Base->CurrentEntry)
387 Base = nullptr;
388 return *this;
389 }
390
391private:
392 BaseT *Base = nullptr;
393};
394
395// The following two templates are used for both MappingNode and Sequence Node.
396template <class CollectionType>
397typename CollectionType::iterator begin(CollectionType &C) {
398 assert(C.IsAtBeginning && "You may only iterate over a collection once!");
399 C.IsAtBeginning = false;
400 typename CollectionType::iterator ret(&C);
401 ++ret;
402 return ret;
403}
404
405template <class CollectionType> void skip(CollectionType &C) {
406 // TODO: support skipping from the middle of a parsed collection ;/
407 assert((C.IsAtBeginning || C.IsAtEnd) && "Cannot skip mid parse!");
408 if (C.IsAtBeginning)
409 for (typename CollectionType::iterator i = begin(C), e = C.end(); i != e;
410 ++i)
411 i->skip();
412}
413
414/// Represents a YAML map created from either a block map for a flow map.
415///
416/// This parses the YAML stream as increment() is called.
417///
418/// Example:
419/// Name: _main
420/// Scope: Global
421class LLVM_ABI MappingNode final : public Node {
422 void anchor() override;
423
424public:
428 MT_Inline ///< An inline mapping node is used for "[key: value]".
429 };
430
431 MappingNode(std::unique_ptr<Document> &D, StringRef Anchor, StringRef Tag,
432 MappingType MT)
433 : Node(NK_Mapping, D, Anchor, Tag), Type(MT) {}
434
436
438
439 template <class T> friend typename T::iterator yaml::begin(T &);
440 template <class T> friend void yaml::skip(T &);
441
442 iterator begin() { return yaml::begin(*this); }
443
444 iterator end() { return iterator(); }
445
446 void skip() override { yaml::skip(*this); }
447
448 static bool classof(const Node *N) {
449 return N->getType() == NK_Mapping;
450 }
451
452private:
453 MappingType Type;
454 bool IsAtBeginning = true;
455 bool IsAtEnd = false;
456 KeyValueNode *CurrentEntry = nullptr;
457
458 void increment();
459};
460
461/// Represents a YAML sequence created from either a block sequence for a
462/// flow sequence.
463///
464/// This parses the YAML stream as increment() is called.
465///
466/// Example:
467/// - Hello
468/// - World
469class LLVM_ABI SequenceNode final : public Node {
470 void anchor() override;
471
472public:
476 // Use for:
477 //
478 // key:
479 // - val1
480 // - val2
481 //
482 // As a BlockMappingEntry and BlockEnd are not created in this case.
484 };
485
486 SequenceNode(std::unique_ptr<Document> &D, StringRef Anchor, StringRef Tag,
487 SequenceType ST)
488 : Node(NK_Sequence, D, Anchor, Tag), SeqType(ST) {}
489
491
493
494 template <class T> friend typename T::iterator yaml::begin(T &);
495 template <class T> friend void yaml::skip(T &);
496
497 void increment();
498
499 iterator begin() { return yaml::begin(*this); }
500
501 iterator end() { return iterator(); }
502
503 void skip() override { yaml::skip(*this); }
504
505 static bool classof(const Node *N) {
506 return N->getType() == NK_Sequence;
507 }
508
509private:
510 SequenceType SeqType;
511 bool IsAtBeginning = true;
512 bool IsAtEnd = false;
513 bool WasPreviousTokenFlowEntry = true; // Start with an imaginary ','.
514 Node *CurrentEntry = nullptr;
515};
516
517/// Represents an alias to a Node with an anchor.
518///
519/// Example:
520/// *AnchorName
521class LLVM_ABI AliasNode final : public Node {
522 void anchor() override;
523
524public:
525 AliasNode(std::unique_ptr<Document> &D, StringRef Val)
526 : Node(NK_Alias, D, StringRef(), StringRef()), Name(Val) {}
527
528 StringRef getName() const { return Name; }
529
530 static bool classof(const Node *N) { return N->getType() == NK_Alias; }
531
532private:
533 StringRef Name;
534};
535
536/// A YAML Stream is a sequence of Documents. A document contains a root
537/// node.
538class Document {
539public:
540 LLVM_ABI Document(Stream &ParentStream);
541
542 /// Root for parsing a node. Returns a single node.
544
545 /// Finish parsing the current document and return true if there are
546 /// more. Return false otherwise.
547 LLVM_ABI bool skip();
548
549 /// Parse and return the root level node.
551 if (Root)
552 return Root;
553 return Root = parseBlockNode();
554 }
555
556 const std::map<StringRef, StringRef> &getTagMap() const { return TagMap; }
557
558private:
559 friend class Node;
560 friend class document_iterator;
561
562 /// Stream to read tokens from.
563 Stream &stream;
564
565 /// Used to allocate nodes to. All are destroyed without calling their
566 /// destructor when the document is destroyed.
567 BumpPtrAllocator NodeAllocator;
568
569 /// The root node. Used to support skipping a partially parsed
570 /// document.
571 Node *Root;
572
573 /// Maps tag prefixes to their expansion.
574 std::map<StringRef, StringRef> TagMap;
575
576 Token &peekNext();
577 Token getNext();
578 void setError(const Twine &Message, Token &Location) const;
579 bool failed() const;
580
581 /// Parse %BLAH directives and return true if any were encountered.
582 bool parseDirectives();
583
584 /// Parse %YAML
585 void parseYAMLDirective();
586
587 /// Parse %TAG
588 void parseTAGDirective();
589
590 /// Consume the next token and error if it is not \a TK.
591 bool expectToken(int TK);
592};
593
594/// Iterator abstraction for Documents over a Stream.
596public:
597 document_iterator() = default;
598 document_iterator(std::unique_ptr<Document> &D) : Doc(&D) {}
599
600 bool operator==(const document_iterator &Other) const {
601 if (isAtEnd() || Other.isAtEnd())
602 return isAtEnd() && Other.isAtEnd();
603
604 return Doc == Other.Doc;
605 }
606 bool operator!=(const document_iterator &Other) const {
607 return !(*this == Other);
608 }
609
611 assert(Doc && "incrementing iterator past the end.");
612 if (!(*Doc)->skip()) {
613 Doc->reset(nullptr);
614 } else {
615 Stream &S = (*Doc)->stream;
616 Doc->reset(new Document(S));
617 }
618 return *this;
619 }
620
621 Document &operator*() { return **Doc; }
622
623 std::unique_ptr<Document> &operator->() { return *Doc; }
624
625private:
626 bool isAtEnd() const { return !Doc || !*Doc; }
627
628 std::unique_ptr<Document> *Doc = nullptr;
629};
630
631} // end namespace yaml
632
633} // end namespace llvm
634
635#endif // LLVM_SUPPORT_YAMLPARSER_H
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the BumpPtrAllocator interface.
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
#define LLVM_ABI
Definition Compiler.h:213
#define T
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
Represents a location in source code.
Definition SMLoc.h:23
static SMLoc getFromPointer(const char *Ptr)
Definition SMLoc.h:36
Represents a range in source code.
Definition SMLoc.h:48
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This owns the files read by a parser, handles include stacks, and handles diagnostic wrangling.
Definition SourceMgr.h:32
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
iterator begin() const
Definition StringRef.h:120
iterator end() const
Definition StringRef.h:122
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition Twine.h:82
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:45
LLVM Value Representation.
Definition Value.h:75
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
AliasNode(std::unique_ptr< Document > &D, StringRef Val)
Definition YAMLParser.h:525
static bool classof(const Node *N)
Definition YAMLParser.h:530
StringRef getName() const
Definition YAMLParser.h:528
static bool classof(const Node *N)
Definition YAMLParser.h:277
BlockScalarNode(std::unique_ptr< Document > &D, StringRef Anchor, StringRef Tag, StringRef Value, StringRef RawVal)
Definition YAMLParser.h:266
StringRef getValue() const
Gets the value of this node as a StringRef.
Definition YAMLParser.h:275
A YAML Stream is a sequence of Documents.
Definition YAMLParser.h:538
LLVM_ABI Node * parseBlockNode()
Root for parsing a node. Returns a single node.
const std::map< StringRef, StringRef > & getTagMap() const
Definition YAMLParser.h:556
LLVM_ABI bool skip()
Finish parsing the current document and return true if there are more.
Node * getRoot()
Parse and return the root level node.
Definition YAMLParser.h:550
friend class Node
Definition YAMLParser.h:559
friend class document_iterator
Definition YAMLParser.h:560
LLVM_ABI Document(Stream &ParentStream)
The Input class is used to parse a yaml document into in-memory structs and vectors.
A key and value pair.
Definition YAMLParser.h:292
Node * getValue()
Parse and return the value.
void skip() override
Definition YAMLParser.h:313
static bool classof(const Node *N)
Definition YAMLParser.h:321
Node * getKey()
Parse and return the key.
KeyValueNode(std::unique_ptr< Document > &D)
Definition YAMLParser.h:296
Represents a YAML map created from either a block map for a flow map.
Definition YAMLParser.h:421
@ MT_Inline
An inline mapping node is used for "[key: value]".
Definition YAMLParser.h:428
static bool classof(const Node *N)
Definition YAMLParser.h:448
basic_collection_iterator< MappingNode, KeyValueNode > iterator
Definition YAMLParser.h:437
MappingNode(std::unique_ptr< Document > &D, StringRef Anchor, StringRef Tag, MappingType MT)
Definition YAMLParser.h:431
void skip() override
Definition YAMLParser.h:446
Abstract base class for all Nodes.
Definition YAMLParser.h:121
StringRef getRawTag() const
Get the tag as it was written in the document.
Definition YAMLParser.h:161
unsigned int getType() const
Definition YAMLParser.h:180
std::unique_ptr< Document > & Doc
Definition YAMLParser.h:183
Node(const Node &)=delete
StringRef getAnchor() const
Get the value of the anchor attached to this node.
Definition YAMLParser.h:157
SMRange SourceRange
Definition YAMLParser.h:184
void setSourceRange(SMRange SR)
Definition YAMLParser.h:168
Node(unsigned int Type, std::unique_ptr< Document > &, StringRef Anchor, StringRef Tag)
virtual void skip()
Definition YAMLParser.h:178
SMRange getSourceRange() const
Definition YAMLParser.h:167
void operator=(const Node &)=delete
NullNode(std::unique_ptr< Document > &D)
Definition YAMLParser.h:203
static bool classof(const Node *N)
Definition YAMLParser.h:206
static bool classof(const Node *N)
Definition YAMLParser.h:238
ScalarNode(std::unique_ptr< Document > &D, StringRef Anchor, StringRef Tag, StringRef Val)
Definition YAMLParser.h:218
StringRef getRawValue() const
Definition YAMLParser.h:229
Scans YAML tokens from a MemoryBuffer.
Represents a YAML sequence created from either a block sequence for a flow sequence.
Definition YAMLParser.h:469
static bool classof(const Node *N)
Definition YAMLParser.h:505
void skip() override
Definition YAMLParser.h:503
SequenceNode(std::unique_ptr< Document > &D, StringRef Anchor, StringRef Tag, SequenceType ST)
Definition YAMLParser.h:486
basic_collection_iterator< SequenceNode, Node > iterator
Definition YAMLParser.h:492
This class represents a YAML stream potentially containing multiple documents.
Definition YAMLParser.h:88
LLVM_ABI document_iterator end()
LLVM_ABI document_iterator begin()
LLVM_ABI ~Stream()
LLVM_ABI Stream(StringRef Input, SourceMgr &, bool ShowColors=true, std::error_code *EC=nullptr)
This keeps a reference to the string referenced by Input.
LLVM_ABI bool failed()
friend class Document
Definition YAMLParser.h:114
LLVM_ABI void printError(Node *N, const Twine &Msg, SourceMgr::DiagKind Kind=SourceMgr::DK_Error)
LLVM_ABI void skip()
This is an iterator abstraction over YAML collections shared by both sequences and maps.
Definition YAMLParser.h:335
bool operator==(const basic_collection_iterator &Other) const
Note on EqualityComparable:
Definition YAMLParser.h:369
basic_collection_iterator & operator++()
Definition YAMLParser.h:382
bool operator!=(const basic_collection_iterator &Other) const
Definition YAMLParser.h:378
std::input_iterator_tag iterator_category
Definition YAMLParser.h:337
Iterator abstraction for Documents over a Stream.
Definition YAMLParser.h:595
document_iterator operator++()
Definition YAMLParser.h:610
document_iterator(std::unique_ptr< Document > &D)
Definition YAMLParser.h:598
bool operator==(const document_iterator &Other) const
Definition YAMLParser.h:600
bool operator!=(const document_iterator &Other) const
Definition YAMLParser.h:606
std::unique_ptr< Document > & operator->()
Definition YAMLParser.h:623
@ C
The default llvm calling convention, compatible with C.
Definition CallingConv.h:34
LLVM_ABI bool dumpTokens(StringRef Input, raw_ostream &)
Dump all the tokens in this stream to OS.
LLVM_ABI std::optional< bool > parseBool(StringRef S)
Parse S as a bool according to https://yaml.org/type/bool.html.
LLVM_ABI bool scanTokens(StringRef Input)
Scans all tokens in input without outputting anything.
void skip(CollectionType &C)
Definition YAMLParser.h:405
CollectionType::iterator begin(CollectionType &C)
Definition YAMLParser.h:397
LLVM_ABI std::string escape(StringRef Input, bool EscapePrintable=true)
Escape Input for a double quoted scalar; if EscapePrintable is true, all UTF8 sequences will be escap...
This is an optimization pass for GlobalISel generic memory operations.
bool failed(LogicalResult Result)
Utility function that returns true if the provided LogicalResult corresponds to a failure value.
BumpPtrAllocatorImpl BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
Definition Allocator.h:383
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key
@ Other
Any other memory.
Definition ModRef.h:68
#define N
Token - A single YAML token.