[PATCH] D19410: [scan-build] fix warnings emitted on LLVM ARM code base

Apelete Seketeli via llvm-commits llvm-commits at lists.llvm.org
Mon May 9 04:12:46 PDT 2016


apelete updated this revision to Diff 56549.
apelete added a comment.

[scan-build] fix warnings emitted on LLVM ARM code base

Changes since last revision:

- lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp: remove asert and check against value MCSymbol pointer and existence of variable value within MCSymbol,

- lib/Target/ARM/Thumb2SizeReduction.cpp: remove assert since BundleMI processing should continue if BundleMI is nullptr.


http://reviews.llvm.org/D19410

Files:
  lib/Target/ARM/AsmParser/ARMAsmParser.cpp
  lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp
  lib/Target/ARM/Thumb2SizeReduction.cpp

Index: lib/Target/ARM/Thumb2SizeReduction.cpp
===================================================================
--- lib/Target/ARM/Thumb2SizeReduction.cpp
+++ lib/Target/ARM/Thumb2SizeReduction.cpp
@@ -988,7 +988,7 @@
         NextMII->bundleWithPred();
     }
 
-    if (!NextInSameBundle && MI->isInsideBundle()) {
+    if (BundleMI && !NextInSameBundle && MI->isInsideBundle()) {
       // FIXME: Since post-ra scheduler operates on bundles, the CPSR kill
       // marker is only on the BUNDLE instruction. Process the BUNDLE
       // instruction as we finish with the bundled instruction to work around
Index: lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp
===================================================================
--- lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp
+++ lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp
@@ -405,15 +405,13 @@
     // FIXME!
     report_fatal_error("FIXME: relocations to absolute targets "
                        "not yet implemented");
-  } else {
+  } else if (A && A->getVariableValue()) {
     // Resolve constant variables.
-    if (A->isVariable()) {
-      int64_t Res;
-      if (A->getVariableValue()->evaluateAsAbsolute(
-              Res, Layout, Writer->getSectionAddressMap())) {
-        FixedValue = Res;
-        return;
-      }
+    int64_t Res;
+    if (A->getVariableValue()->evaluateAsAbsolute(
+            Res, Layout, Writer->getSectionAddressMap())) {
+      FixedValue = Res;
+      return;
     }
 
     // Check whether we need an external or internal relocation.
Index: lib/Target/ARM/AsmParser/ARMAsmParser.cpp
===================================================================
--- lib/Target/ARM/AsmParser/ARMAsmParser.cpp
+++ lib/Target/ARM/AsmParser/ARMAsmParser.cpp
@@ -9961,7 +9961,9 @@
     return true;
 
   // '.align' is target specifically handled to mean 2**2 byte alignment.
-  if (getStreamer().getCurrentSection().first->UseCodeAlign())
+  const MCSection *Section = getStreamer().getCurrentSection().first;
+  assert(Section && "must have section to emit alignment");
+  if (Section->UseCodeAlign())
     getStreamer().EmitCodeAlignment(4, 0);
   else
     getStreamer().EmitValueToAlignment(4, 0, 1, 0);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19410.56549.patch
Type: text/x-patch
Size: 2216 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160509/4fd66313/attachment.bin>


More information about the llvm-commits mailing list