diff options
Diffstat (limited to 'llvm/lib/Remarks/YAMLRemarkParser.h')
-rw-r--r-- | llvm/lib/Remarks/YAMLRemarkParser.h | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/llvm/lib/Remarks/YAMLRemarkParser.h b/llvm/lib/Remarks/YAMLRemarkParser.h index 5fd17865b69..fb25f241975 100644 --- a/llvm/lib/Remarks/YAMLRemarkParser.h +++ b/llvm/lib/Remarks/YAMLRemarkParser.h @@ -40,7 +40,7 @@ struct YAMLRemarkParser { /// Temporary parsing buffer for the arguments. SmallVector<Argument, 8> TmpArgs; /// The string table used for parsing strings. - Optional<ParsedStringTable> StrTab; + Optional<const ParsedStringTable *> StrTab; /// The state used by the parser to parse a remark entry. Invalidated with /// every call to `parseYAMLElement`. struct ParseState { @@ -59,13 +59,11 @@ struct YAMLRemarkParser { /// not be containing any value. Optional<ParseState> State; - YAMLRemarkParser(StringRef Buf, Optional<StringRef> StrTabBuf = None) + YAMLRemarkParser(StringRef Buf, + Optional<const ParsedStringTable *> StrTab = None) : SM(), Stream(Buf, SM), ErrorString(), ErrorStream(ErrorString), - TmpArgs(), StrTab() { + TmpArgs(), StrTab(StrTab) { SM.setDiagHandler(YAMLRemarkParser::HandleDiagnostic, this); - - if (StrTabBuf) - StrTab.emplace(*StrTabBuf); } /// Parse a YAML element. @@ -127,8 +125,9 @@ struct YAMLParserImpl : public ParserImpl { /// Set to `true` if we had any errors during parsing. bool HasErrors = false; - YAMLParserImpl(StringRef Buf, Optional<StringRef> StrTabBuf = None) - : ParserImpl{ParserImpl::Kind::YAML}, YAMLParser(Buf, StrTabBuf), + YAMLParserImpl(StringRef Buf, + Optional<const ParsedStringTable *> StrTab = None) + : ParserImpl{ParserImpl::Kind::YAML}, YAMLParser(Buf, StrTab), YAMLIt(YAMLParser.Stream.begin()), HasErrors(false) {} static bool classof(const ParserImpl *PI) { |