OSDN Git Service

[ARM] Fix compiler warning
authorMikael Holmen <mikael.holmen@ericsson.com>
Wed, 12 Jun 2019 14:19:22 +0000 (14:19 +0000)
committerMikael Holmen <mikael.holmen@ericsson.com>
Wed, 12 Jun 2019 14:19:22 +0000 (14:19 +0000)
commit50037cbd51f319cfdf03f3c2b453481f737e3610
tree6a2a0ba032b9897a1677f46bb34b03488f406b04
parent76425803623ef73d526e4370b885aee6f60d12b1
[ARM] Fix compiler warning

Without this fix clang 3.6 complains with:

../lib/Target/ARM/ARMAsmPrinter.cpp:1473:18: error: variable 'BranchTarget' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
      } else if (MI->getOperand(1).isSymbol()) {
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../lib/Target/ARM/ARMAsmPrinter.cpp:1479:22: note: uninitialized use occurs here
      MCInst.addExpr(BranchTarget);
                     ^~~~~~~~~~~~
../lib/Target/ARM/ARMAsmPrinter.cpp:1473:14: note: remove the 'if' if its condition is always true
      } else if (MI->getOperand(1).isSymbol()) {
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../lib/Target/ARM/ARMAsmPrinter.cpp:1465:33: note: initialize the variable 'BranchTarget' to silence this warning
      const MCExpr *BranchTarget;
                                ^
                                 = nullptr
1 error generated.

Discussed here:
 http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20190610/661417.html

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363166 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/ARM/ARMAsmPrinter.cpp