15 #include "BitstreamRemarkParser.h" 27 while (!InBuffer.
empty()) {
29 std::pair<StringRef, StringRef> Split = InBuffer.
split(
'\0');
32 InBuffer = Split.second;
40 "String with index %u is out of bounds (size = %u).",
Index,
53 switch (ParserFormat) {
55 return std::make_unique<YAMLRemarkParser>(Buf);
59 "The YAML with string table format requires a parsed string table.");
61 return std::make_unique<BitstreamRemarkParser>(Buf);
64 "Unknown remark parser format.");
72 switch (ParserFormat) {
75 "The YAML format can't be used with a string " 76 "table. Use yaml-strtab instead.");
78 return std::make_unique<YAMLStrTabRemarkParser>(Buf, std::move(StrTab));
80 return std::make_unique<BitstreamRemarkParser>(Buf, std::move(StrTab));
83 "Unknown remark parser format.");
92 switch (ParserFormat) {
98 std::move(ExternalFilePrependPath));
101 std::move(ExternalFilePrependPath));
104 "Unknown remark parser format.");
112 std::unique_ptr<RemarkParser> TheParser;
122 bool hasError()
const {
return Err.
hasValue(); }
123 const char *getMessage()
const {
return Err ? Err->c_str() :
nullptr; };
139 StringRef(static_cast<const char *>(Buf), Size)));
144 CParser &TheCParser = *
unwrap(Parser);
156 TheCParser.handleError(std::move(
E));
161 return wrap(MaybeRemark->release());
165 return unwrap(Parser)->hasError();
168 extern "C" const char *
170 return unwrap(Parser)->getMessage();
void cantFail(Error Err, const char *Msg=nullptr)
Report a fatal error if Err is a failure value.
This class represents lattice values for constants.
void emplace(ArgTypes &&... Args)
Create a new object by constructing it in place with the given arguments.
Error takeError()
Take ownership of the stored error.
std::string toString(Error E)
Write all error messages (if any) in E to a string.
#define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)
Attribute unwrap(LLVMAttributeRef Attr)
std::error_code make_error_code(BitcodeError E)
Tagged union holding either a T or a Error.
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
LLVM_NODISCARD size_t size() const
size - Get the string size.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
void consumeError(Error Err)
Consume a Error without doing anything.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
LLVM_NODISCARD std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
LLVMAttributeRef wrap(Attribute Attr)
LLVM_NODISCARD const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
Lightweight error class with error context and mandatory checking.
StringRef - Represent a constant reference to a string, i.e.
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.