Verifier: Check for incompatible bit piece expressions

Convert an assertion into a `Verifier` check.  Bit piece expressions
must fit inside the variable, and mustn't be the entire variable.
Catching this in the verifier will help us find bugs sooner, and makes
`DIVariable::getSizeInBits()` dead code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234698 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith
2015-04-11 19:58:35 +00:00
parent 429f5391ad
commit 3ec16b419f
4 changed files with 90 additions and 32 deletions

View File

@ -1535,15 +1535,7 @@ void DebugLocEntry::finalize(const AsmPrinter &AP,
Offset += PieceOffset-Offset;
}
Offset += PieceSize;
#ifndef NDEBUG
DIVariable Var = Piece.getVariable();
unsigned VarSize = Var.getSizeInBits(TypeIdentifierMap);
assert(PieceSize+PieceOffset <= VarSize
&& "piece is larger than or outside of variable");
assert(PieceSize != VarSize
&& "piece covers entire variable");
#endif
emitDebugLocValue(AP, TypeIdentifierMap, Streamer, Piece, PieceOffset);
}
} else {