|
LLVM 24.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. | |
| Public Member Functions inherited from llvm::remarks::RemarkParser | |
| RemarkParser (Format ParserFormat) | |
| virtual | ~RemarkParser ()=default |
Static Public Member Functions | |
| static bool | classof (const RemarkParser *P) |
Public Attributes | |
| 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. | |
| BumpPtrAllocator | Alloc |
| Storage for values that do not point into the input buffer: unescaped scalars and block scalars. | |
| Public Attributes inherited from llvm::remarks::RemarkParser | |
| Format | ParserFormat |
| The format of the parser. | |
| std::string | ExternalFilePrependPath |
| Path to prepend when opening an external remark file. | |
Protected Member Functions | |
| 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 > | parseScalar (yaml::ScalarNode &Node) |
| Decode a scalar, unescaping quoted forms. | |
| 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 49 of file YAMLRemarkParser.h.
| YAMLRemarkParser::YAMLRemarkParser | ( | StringRef | Buf | ) |
Definition at line 146 of file YAMLRemarkParser.cpp.
References LastErrorMessage, llvm::remarks::RemarkParser::RemarkParser(), setupSM(), SM, Stream, llvm::remarks::YAML, and YAMLIt.
|
inlinestatic |
Definition at line 70 of file YAMLRemarkParser.h.
References P, llvm::remarks::RemarkParser::RemarkParser(), 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 154 of file YAMLRemarkParser.cpp.
References LastErrorMessage, llvm::make_error(), and llvm::Error::success().
Referenced by parseArg(), parseDebugLoc(), parseKey(), parseRemark(), parseScalar(), parseStr(), parseType(), and parseUnsigned().
|
protected |
Create a YAMLParseError error referencing a specific node.
Definition at line 150 of file YAMLRemarkParser.cpp.
References llvm::make_error(), SM, and Stream.
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 401 of file YAMLRemarkParser.cpp.
References llvm::make_error(), parseRemark(), Stream, llvm::Expected< T >::takeError(), and YAMLIt.
|
protected |
Parse an argument.
Definition at line 346 of file YAMLRemarkParser.cpp.
References llvm::dyn_cast(), error(), llvm::remarks::Argument::Key, llvm::remarks::Argument::Loc, parseDebugLoc(), parseKey(), parseStr(), llvm::Expected< T >::takeError(), and llvm::remarks::Argument::Val.
Referenced by parseRemark().
|
protected |
Parse a debug location.
Definition at line 304 of file YAMLRemarkParser.cpp.
References llvm::dyn_cast_if_present(), error(), parseKey(), parseStr(), parseUnsigned(), and llvm::Expected< T >::takeError().
Referenced by parseArg(), and parseRemark().
|
protected |
Parse one key to a string.
Definition at line 272 of file YAMLRemarkParser.cpp.
References llvm::dyn_cast_if_present(), error(), llvm::InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key, and parseScalar().
Referenced by parseArg(), parseDebugLoc(), and parseRemark().
|
protected |
Parse a YAML remark to a remarks::Remark object.
Definition at line 163 of file YAMLRemarkParser.cpp.
References llvm::remarks::Remark::Args, llvm::createStringError(), llvm::dyn_cast(), llvm::dyn_cast_if_present(), 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, T, llvm::Expected< T >::takeError(), and llvm::remarks::Unknown.
Referenced by next().
|
protected |
Decode a scalar, unescaping quoted forms.
Definition at line 260 of file YAMLRemarkParser.cpp.
References Alloc, llvm::SmallVectorTemplateCommon< T, typename >::empty(), and error().
Referenced by parseKey(), and parseStr().
|
protectedvirtual |
Parse one value to a string.
Definition at line 279 of file YAMLRemarkParser.cpp.
References Alloc, llvm::Block, llvm::dyn_cast_if_present(), error(), parseScalar(), and Scalar.
Referenced by parseArg(), parseDebugLoc(), and parseRemark().
|
protected |
Parse the type of a remark to an enum type.
Definition at line 246 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 292 of file YAMLRemarkParser.cpp.
References llvm::dyn_cast_if_present(), and error().
Referenced by parseDebugLoc(), and parseRemark().
| BumpPtrAllocator llvm::remarks::YAMLRemarkParser::Alloc |
Storage for values that do not point into the input buffer: unescaped scalars and block scalars.
Remarks point into it.
Definition at line 64 of file YAMLRemarkParser.h.
Referenced by parseScalar(), and 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 52 of file YAMLRemarkParser.h.
Referenced by error(), and YAMLRemarkParser().
| 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 61 of file YAMLRemarkParser.h.
| SourceMgr llvm::remarks::YAMLRemarkParser::SM |
Source manager for better error messages.
Definition at line 54 of file YAMLRemarkParser.h.
Referenced by error(), and YAMLRemarkParser().
| yaml::Stream llvm::remarks::YAMLRemarkParser::Stream |
Stream for yaml parsing.
Definition at line 56 of file YAMLRemarkParser.h.
Referenced by error(), next(), and YAMLRemarkParser().
| yaml::document_iterator llvm::remarks::YAMLRemarkParser::YAMLIt |
Iterator in the YAML stream.
Definition at line 58 of file YAMLRemarkParser.h.
Referenced by next(), and YAMLRemarkParser().