DebugInfo: fix incorrect alignment type (NFC)

Change type of some missed DebugInfo-related alignment variables,
that are still uint64_t, to uint32_t.

Original change introduced in r284482.

llvm-svn: 285242
This commit is contained in:
Victor Leschuk
2016-10-26 21:32:29 +00:00
parent 5ceeb60c6e
commit a37660c669
6 changed files with 36 additions and 25 deletions

View File

@@ -2742,7 +2742,12 @@ std::error_code BitcodeReader::parseMetadata(bool ModuleLevel) {
// Upgrade old metadata, which stored a global variable reference or a
// ConstantInt here.
Metadata *Expr = getMDOrNull(Record[9]);
uint64_t AlignInBits = (Record.size() > 11) ? Record[11] : 0;
uint32_t AlignInBits = 0;
if (Record.size() > 11) {
if (Record[11] > (uint64_t)std::numeric_limits<uint32_t>::max())
return error("Alignment value is too large");
AlignInBits = Record[11];
}
GlobalVariable *Attach = nullptr;
if (auto *CMD = dyn_cast_or_null<ConstantAsMetadata>(Expr)) {
if (auto *GV = dyn_cast<GlobalVariable>(CMD->getValue())) {
@@ -2782,7 +2787,13 @@ std::error_code BitcodeReader::parseMetadata(bool ModuleLevel) {
// this is newer version of record which doesn't have artifical tag.
bool HasTag = !HasAlignment && Record.size() > 8;
DINode::DIFlags Flags = static_cast<DINode::DIFlags>(Record[7 + HasTag]);
uint64_t AlignInBits = HasAlignment ? Record[8 + HasTag] : 0;
uint32_t AlignInBits = 0;
if (HasAlignment) {
if (Record[8 + HasTag] >
(uint64_t)std::numeric_limits<uint32_t>::max())
return error("Alignment value is too large");
AlignInBits = Record[8 + HasTag];
}
MetadataList.assignValue(
GET_OR_DISTINCT(DILocalVariable,
(Context, getMDOrNull(Record[1 + HasTag]),