diff options
author | Nikita Popov <npopov@redhat.com> | 2022-02-07 11:15:43 +0100 |
---|---|---|
committer | Nikita Popov <npopov@redhat.com> | 2022-02-07 12:16:12 +0100 |
commit | 89017772d9a7dc66398227fe23a9f8a1f5fabda3 (patch) | |
tree | c36dcc984fab1ea1706138461b501834f274dcfb /llvm/lib/Bitcode/Reader/BitcodeReader.cpp | |
parent | 3c86642edd28f1ce970882edaba8dce468ec7401 (diff) | |
download | llvm-89017772d9a7dc66398227fe23a9f8a1f5fabda3.zip llvm-89017772d9a7dc66398227fe23a9f8a1f5fabda3.tar.gz llvm-89017772d9a7dc66398227fe23a9f8a1f5fabda3.tar.bz2 |
[Bitcode] Don't assert on invalid attribute group record
Report an error instead.
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 51159c6..308986a 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -1647,9 +1647,7 @@ Error BitcodeReader::parseAttributeGroupBlock() { } B.addAttribute(KindStr.str(), ValStr.str()); - } else { - assert((Record[i] == 5 || Record[i] == 6) && - "Invalid attribute group entry"); + } else if (Record[i] == 5 || Record[i] == 6) { bool HasType = Record[i] == 6; Attribute::AttrKind Kind; if (Error Err = parseAttrKind(Record[++i], &Kind)) @@ -1658,6 +1656,8 @@ Error BitcodeReader::parseAttributeGroupBlock() { return error("Not a type attribute"); B.addTypeAttr(Kind, HasType ? getTypeByID(Record[++i]) : nullptr); + } else { + return error("Invalid attribute group entry"); } } |