MCParser: add an assertion

Add an assertion that the section is not NULL.  Potential NULL pointer
dereference identified by clang static analyzer.

llvm-svn: 204429
This commit is contained in:
Saleem Abdulrasool 2014-03-21 05:13:23 +00:00
parent 62c87d2509
commit 7f2f9f402c

View File

@ -2694,7 +2694,9 @@ bool AsmParser::parseDirectiveAlign(bool IsPow2, unsigned ValueSize) {
// Check whether we should use optimal code alignment for this .align
// directive.
bool UseCodeAlign = getStreamer().getCurrentSection().first->UseCodeAlign();
const MCSection *Section = getStreamer().getCurrentSection().first;
assert(Section && "must have section to emit alignment");
bool UseCodeAlign = Section->UseCodeAlign();
if ((!HasFillExpr || Lexer.getMAI().getTextAlignFillValue() == FillExpr) &&
ValueSize == 1 && UseCodeAlign) {
getStreamer().EmitCodeAlignment(Alignment, MaxBytesToFill);