summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCParser/AsmParser.cpp
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2014-03-21 05:13:23 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2014-03-21 05:13:23 +0000
commit7f2f9f402c0e05843697b2955ad719a27cf2cb99 (patch)
tree3d2f1edf498012efd53aca4c2b36d365d9ef5a0b /llvm/lib/MC/MCParser/AsmParser.cpp
parent62c87d2509bca87ee544e2148c231cb7c0978fef (diff)
downloadbcm5719-llvm-7f2f9f402c0e05843697b2955ad719a27cf2cb99.tar.gz
bcm5719-llvm-7f2f9f402c0e05843697b2955ad719a27cf2cb99.zip
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
Diffstat (limited to 'llvm/lib/MC/MCParser/AsmParser.cpp')
-rw-r--r--llvm/lib/MC/MCParser/AsmParser.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp
index 665e3d33d88..ca603cf6130 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/lib/MC/MCParser/AsmParser.cpp
@@ -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);
OpenPOWER on IntegriCloud