summaryrefslogtreecommitdiff
path: root/tools/llvm-mc/llvm-mc.cpp
diff options
context:
space:
mode:
authorEli Bendersky <eliben@google.com>2013-02-26 23:04:17 +0000
committerEli Bendersky <eliben@google.com>2013-02-26 23:04:17 +0000
commit533048228fe7bf3bac05e7db3d2f12aaf3f47fa1 (patch)
treeff174d651ffb9eb230ffa1d8cf15493a5dc391eb /tools/llvm-mc/llvm-mc.cpp
parent616025007abbb0fb53fe53ef2cac81907668c2f0 (diff)
downloadllvm-533048228fe7bf3bac05e7db3d2f12aaf3f47fa1.tar.gz
llvm-533048228fe7bf3bac05e7db3d2f12aaf3f47fa1.tar.bz2
llvm-533048228fe7bf3bac05e7db3d2f12aaf3f47fa1.tar.xz
Try to get rid of a -wunitialized warning: explicitly initialize the pointer
to NULL and use asserts to check in relevant places. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176134 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-mc/llvm-mc.cpp')
-rw-r--r--tools/llvm-mc/llvm-mc.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/llvm-mc/llvm-mc.cpp b/tools/llvm-mc/llvm-mc.cpp
index 68f1a70bb2..243899bb88 100644
--- a/tools/llvm-mc/llvm-mc.cpp
+++ b/tools/llvm-mc/llvm-mc.cpp
@@ -427,7 +427,7 @@ int main(int argc, char **argv) {
OwningPtr<MCSubtargetInfo>
STI(TheTarget->createMCSubtargetInfo(TripleName, MCPU, FeaturesStr));
- MCInstPrinter *IP;
+ MCInstPrinter *IP = NULL;
if (FileType == OFT_AssemblyFile) {
IP =
TheTarget->createMCInstPrinter(OutputAsmVariant, *MAI, *MCII, *MRI, *STI);
@@ -465,10 +465,12 @@ int main(int argc, char **argv) {
Res = AssembleInput(ProgName, TheTarget, SrcMgr, Ctx, *Str, *MAI, *STI);
break;
case AC_MDisassemble:
+ assert(IP && "Expected assembly output");
IP->setUseMarkup(1);
disassemble = true;
break;
case AC_HDisassemble:
+ assert(IP && "Expected assembly output");
IP->setPrintImmHex(1);
disassemble = true;
break;