[PATCH] D69751: [AsmWritter] Fixed "null check after dereferencing" warning
Dávid Bolvanský via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 2 12:29:21 PDT 2019
xbolva00 updated this revision to Diff 227585.
xbolva00 added a comment.
Addressed review comment.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D69751/new/
https://reviews.llvm.org/D69751
Files:
llvm/lib/IR/AsmWriter.cpp
Index: llvm/lib/IR/AsmWriter.cpp
===================================================================
--- llvm/lib/IR/AsmWriter.cpp
+++ llvm/lib/IR/AsmWriter.cpp
@@ -3564,6 +3564,7 @@
/// printBasicBlock - This member is called for each basic block in a method.
void AssemblyWriter::printBasicBlock(const BasicBlock *BB) {
+ assert(BB && BB->getParent() && "block without parent!");
bool IsEntryBlock = BB == &BB->getParent()->getEntryBlock();
if (BB->hasName()) { // Print out the label if it exists...
Out << "\n";
@@ -3578,10 +3579,7 @@
Out << "<badref>:";
}
- if (!BB->getParent()) {
- Out.PadToColumn(50);
- Out << "; Error: Block without parent!";
- } else if (!IsEntryBlock) {
+ if (!IsEntryBlock) {
// Output predecessors for the block.
Out.PadToColumn(50);
Out << ";";
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69751.227585.patch
Type: text/x-patch
Size: 842 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191102/4bc69d9f/attachment.bin>
More information about the llvm-commits
mailing list