LLVM 17.0.0git
|
Regular YAML to Remark parser. More...
#include "Remarks/YAMLRemarkParser.h"
Public Member Functions | |
YAMLRemarkParser (StringRef Buf) | |
Expected< std::unique_ptr< Remark > > | next () override |
If no error occurs, this returns a valid Remark object. | |
![]() | |
RemarkParser (Format ParserFormat) | |
virtual Expected< std::unique_ptr< Remark > > | next ()=0 |
If no error occurs, this returns a valid Remark object. | |
virtual | ~RemarkParser ()=default |
Static Public Member Functions | |
static bool | classof (const RemarkParser *P) |
Public Attributes | |
std::optional< ParsedStringTable > | StrTab |
The string table used for parsing strings. | |
std::string | LastErrorMessage |
Last error message that can come from the YAML parser diagnostics. | |
SourceMgr | SM |
Source manager for better error messages. | |
yaml::Stream | Stream |
Stream for yaml parsing. | |
yaml::document_iterator | YAMLIt |
Iterator in the YAML stream. | |
std::unique_ptr< MemoryBuffer > | SeparateBuf |
If we parse remark metadata in separate mode, we need to open a new file and parse that. | |
![]() | |
Format | ParserFormat |
The format of the parser. | |
std::string | ExternalFilePrependPath |
Path to prepend when opening an external remark file. | |
Protected Member Functions | |
YAMLRemarkParser (StringRef Buf, std::optional< ParsedStringTable > StrTab) | |
Error | error () |
Create a YAMLParseError error from an existing error generated by the YAML parser. | |
Error | error (StringRef Message, yaml::Node &Node) |
Create a YAMLParseError error referencing a specific node. | |
Expected< std::unique_ptr< Remark > > | parseRemark (yaml::Document &Remark) |
Parse a YAML remark to a remarks::Remark object. | |
Expected< Type > | parseType (yaml::MappingNode &Node) |
Parse the type of a remark to an enum type. | |
Expected< StringRef > | parseKey (yaml::KeyValueNode &Node) |
Parse one key to a string. | |
virtual Expected< StringRef > | parseStr (yaml::KeyValueNode &Node) |
Parse one value to a string. | |
Expected< unsigned > | parseUnsigned (yaml::KeyValueNode &Node) |
Parse one value to an unsigned. | |
Expected< RemarkLocation > | parseDebugLoc (yaml::KeyValueNode &Node) |
Parse a debug location. | |
Expected< Argument > | parseArg (yaml::Node &Node) |
Parse an argument. | |
Regular YAML to Remark parser.
Definition at line 48 of file YAMLRemarkParser.h.
YAMLRemarkParser::YAMLRemarkParser | ( | StringRef | Buf | ) |
Definition at line 169 of file YAMLRemarkParser.cpp.
|
protected |
Definition at line 172 of file YAMLRemarkParser.cpp.
|
inlinestatic |
Definition at line 68 of file YAMLRemarkParser.h.
References P, and llvm::remarks::YAML.
|
protected |
Create a YAMLParseError error from an existing error generated by the YAML parser.
If there is no error, this returns Success.
Definition at line 181 of file YAMLRemarkParser.cpp.
References E, LastErrorMessage, and llvm::Error::success().
Referenced by parseArg(), parseDebugLoc(), parseKey(), parseRemark(), parseStr(), llvm::remarks::YAMLStrTabRemarkParser::parseStr(), parseType(), and parseUnsigned().
|
protected |
Create a YAMLParseError error referencing a specific node.
Definition at line 177 of file YAMLRemarkParser.cpp.
If no error occurs, this returns a valid Remark object.
If an error of type EndOfFileError occurs, it is safe to recover from it by stopping the parsing. If any other error occurs, it should be propagated to the user. The pointer should never be null.
Implements llvm::remarks::RemarkParser.
Definition at line 413 of file YAMLRemarkParser.cpp.
References llvm::yaml::Stream::end(), parseRemark(), Stream, llvm::Expected< T >::takeError(), and YAMLIt.
|
protected |
Parse an argument.
Definition at line 362 of file YAMLRemarkParser.cpp.
References error(), parseDebugLoc(), parseKey(), parseStr(), and llvm::Expected< T >::takeError().
Referenced by parseRemark().
|
protected |
Parse a debug location.
Definition at line 320 of file YAMLRemarkParser.cpp.
References error(), parseKey(), parseStr(), parseUnsigned(), and llvm::Expected< T >::takeError().
Referenced by parseArg(), and parseRemark().
|
protected |
Parse one key to a string.
Definition at line 286 of file YAMLRemarkParser.cpp.
References error().
Referenced by parseArg(), parseDebugLoc(), and parseRemark().
|
protected |
Parse a YAML remark to a remarks::Remark object.
Definition at line 190 of file YAMLRemarkParser.cpp.
References Arg, llvm::remarks::Remark::Args, llvm::createStringError(), E, llvm::StringRef::empty(), error(), llvm::remarks::Remark::FunctionName, llvm::yaml::Document::getRoot(), llvm::remarks::Remark::Hotness, llvm::remarks::Remark::Loc, parseArg(), parseDebugLoc(), parseKey(), parseStr(), parseType(), parseUnsigned(), llvm::remarks::Remark::PassName, llvm::remarks::Remark::RemarkName, llvm::remarks::Remark::RemarkType, llvm::Expected< T >::takeError(), and llvm::remarks::Unknown.
Referenced by next().
|
protectedvirtual |
Parse one value to a string.
Reimplemented in llvm::remarks::YAMLStrTabRemarkParser.
Definition at line 293 of file YAMLRemarkParser.cpp.
References error().
Referenced by parseArg(), parseDebugLoc(), and parseRemark().
|
protected |
Parse the type of a remark to an enum type.
Definition at line 272 of file YAMLRemarkParser.cpp.
References llvm::remarks::Analysis, llvm::remarks::AnalysisAliasing, llvm::remarks::AnalysisFPCommute, llvm::StringSwitch< T, R >::Case(), llvm::StringSwitch< T, R >::Default(), error(), llvm::remarks::Failure, llvm::remarks::Missed, llvm::remarks::Passed, and llvm::remarks::Unknown.
Referenced by parseRemark().
|
protected |
Parse one value to an unsigned.
Definition at line 308 of file YAMLRemarkParser.cpp.
References error().
Referenced by parseDebugLoc(), parseRemark(), and llvm::remarks::YAMLStrTabRemarkParser::parseStr().
std::string llvm::remarks::YAMLRemarkParser::LastErrorMessage |
Last error message that can come from the YAML parser diagnostics.
We need this for catching errors in the constructor.
Definition at line 53 of file YAMLRemarkParser.h.
Referenced by error().
std::unique_ptr<MemoryBuffer> llvm::remarks::YAMLRemarkParser::SeparateBuf |
If we parse remark metadata in separate mode, we need to open a new file and parse that.
Definition at line 62 of file YAMLRemarkParser.h.
SourceMgr llvm::remarks::YAMLRemarkParser::SM |
Source manager for better error messages.
Definition at line 55 of file YAMLRemarkParser.h.
Referenced by error().
yaml::Stream llvm::remarks::YAMLRemarkParser::Stream |
Stream for yaml parsing.
Definition at line 57 of file YAMLRemarkParser.h.
std::optional<ParsedStringTable> llvm::remarks::YAMLRemarkParser::StrTab |
The string table used for parsing strings.
Definition at line 50 of file YAMLRemarkParser.h.
Referenced by llvm::remarks::YAMLStrTabRemarkParser::parseStr().
yaml::document_iterator llvm::remarks::YAMLRemarkParser::YAMLIt |
Iterator in the YAML stream.
Definition at line 59 of file YAMLRemarkParser.h.
Referenced by next().