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

Renato Golin via llvm-commits llvm-commits at lists.llvm.org
Thu May 5 09:11:09 PDT 2016


rengolin added inline comments.

================
Comment at: lib/Target/ARM/AsmParser/ARMAsmParser.cpp:9965
@@ +9964,3 @@
+  const MCSection *Section = getStreamer().getCurrentSection().first;
+  assert(Section && "must have section to emit alignment");
+  if (Section->UseCodeAlign())
----------------
compnerd wrote:
> rengolin wrote:
> > We don't want asserts in assembly parsers, people can write pretty much anything. Make this an error.
> Yes, adding an error here would be reasonable, however, if we do that, please add a test case that demonstrates the invalid input.  I believe that the assertion here is valid as we will always have a section (even if the user inserts it in the wrong location, theres the implicit initial text section to which we will refer).
If not having a section here is an assembler error, not an assembly error, than asserting is fine. Users should never see this.


http://reviews.llvm.org/D19410





More information about the llvm-commits mailing list