summaryrefslogtreecommitdiff
path: root/lib
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
commit6785cf007c4eeefc8e0b0c1723dc98f9ad07f4be (patch)
treee9fef5aeb30db7eafadefc861bbcf2aae61260cb /lib
parent705e53e2aa854a04b5ce0cc8ddcd98a6a16c46e3 (diff)
MCParser: add an assertion
Add an assertion that the section is not NULL. Potential NULL pointer dereference identified by clang static analyzer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204429 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/MC/MCParser/AsmParser.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp
index 665e3d33d88..ca603cf6130 100644
--- a/lib/MC/MCParser/AsmParser.cpp
+++ b/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);