Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/Remarks/RemarkParser.cpp
Show First 20 Lines • Show All 108 Lines • ▼ Show 20 Lines | |||||
namespace { | namespace { | ||||
// Wrapper that holds the state needed to interact with the C API. | // Wrapper that holds the state needed to interact with the C API. | ||||
struct CParser { | struct CParser { | ||||
std::unique_ptr<RemarkParser> TheParser; | std::unique_ptr<RemarkParser> TheParser; | ||||
Optional<std::string> Err; | Optional<std::string> Err; | ||||
CParser(Format ParserFormat, StringRef Buf, | CParser(Format ParserFormat, StringRef Buf, | ||||
Optional<ParsedStringTable> StrTab = None) | Optional<ParsedStringTable> StrTab = None) | ||||
: TheParser(cantFail( | : TheParser(llvm_cantFail( | ||||
StrTab ? createRemarkParser(ParserFormat, Buf, std::move(*StrTab)) | StrTab ? createRemarkParser(ParserFormat, Buf, std::move(*StrTab)) | ||||
: createRemarkParser(ParserFormat, Buf))) {} | : createRemarkParser(ParserFormat, Buf))) {} | ||||
void handleError(Error E) { Err.emplace(toString(std::move(E))); } | void handleError(Error E) { Err.emplace(toString(std::move(E))); } | ||||
bool hasError() const { return Err.hasValue(); } | bool hasError() const { return Err.hasValue(); } | ||||
const char *getMessage() const { return Err ? Err->c_str() : nullptr; }; | const char *getMessage() const { return Err ? Err->c_str() : nullptr; }; | ||||
}; | }; | ||||
} // namespace | } // namespace | ||||
▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines |