- Fix uninitialized variable warnings.
- Reuse BitstreamEntry iterator to avoid Wshadow warning.
- Match declaration + definition arg names in BitstreamRemarkParser::processCommonMeta
- Make BitstreamRemarkParser(StringRef) constructor explicit
/// This contains information emitted to BLOCKINFO_BLOCK blocks. These
/// describe abbreviations that all blocks of the specified ID inherit.
struct BlockInfo {
- unsigned BlockID;
+ unsigned BlockID = 0;
std::vector<std::shared_ptr<BitCodeAbbrev>> Abbrevs;
std::string Name;
std::vector<std::pair<unsigned, std::string>> RecordNames;
struct RemarkLocation {
/// Absolute path of the source file corresponding to this remark.
StringRef SourceFilePath;
- unsigned SourceLine;
- unsigned SourceColumn;
+ unsigned SourceLine = 0;
+ unsigned SourceColumn = 0;
};
// Create wrappers for C Binding types (see CBindingWrapping.h).
// Stop when there is nothing to read anymore or when we encounter an
// END_BLOCK.
while (!Stream.AtEndOfStream()) {
- Expected<BitstreamEntry> Next = Stream.advance();
+ Next = Stream.advance();
if (!Next)
return Next.takeError();
switch (Next->Kind) {
}
Error BitstreamRemarkParser::processCommonMeta(
- BitstreamMetaParserHelper &MetaHelper) {
- if (Optional<uint64_t> Version = MetaHelper.ContainerVersion)
+ BitstreamMetaParserHelper &Helper) {
+ if (Optional<uint64_t> Version = Helper.ContainerVersion)
ContainerVersion = *Version;
else
return createStringError(
std::make_error_code(std::errc::illegal_byte_sequence),
"Error while parsing BLOCK_META: missing container version.");
- if (Optional<uint8_t> Type = MetaHelper.ContainerType) {
+ if (Optional<uint8_t> Type = Helper.ContainerType) {
// Always >= BitstreamRemarkContainerType::First since it's unsigned.
if (*Type > static_cast<uint8_t>(BitstreamRemarkContainerType::Last))
return createStringError(
std::unique_ptr<MemoryBuffer> TmpRemarkBuffer;
/// The common metadata used to decide how to parse the buffer.
/// This is filled when parsing the metadata block.
- uint64_t ContainerVersion;
- uint64_t RemarkVersion;
- BitstreamRemarkContainerType ContainerType;
+ uint64_t ContainerVersion = 0;
+ uint64_t RemarkVersion = 0;
+ BitstreamRemarkContainerType ContainerType =
+ BitstreamRemarkContainerType::Standalone;
/// Wether the parser is ready to parse remarks.
bool ReadyToParseRemarks = false;
/// Create a parser that expects to find a string table embedded in the
/// stream.
- BitstreamRemarkParser(StringRef Buf)
+ explicit BitstreamRemarkParser(StringRef Buf)
: RemarkParser(Format::Bitstream), ParserHelper(Buf) {}
/// Create a parser that uses a pre-parsed string table.