Skip to content

Commit

Permalink
AsmPrinter - emitGlobalConstantFP - silence static analyzer null dere…
Browse files Browse the repository at this point in the history
…ference warning. NFCI.

All the calls to emitGlobalConstantFP should provide a nonnull Type for the float.

llvm-svn: 373464
  • Loading branch information
RKSimon committed Oct 2, 2019
1 parent 5591722 commit 369d16a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2476,18 +2476,15 @@ static void emitGlobalConstantStruct(const DataLayout &DL,
}

static void emitGlobalConstantFP(APFloat APF, Type *ET, AsmPrinter &AP) {
assert(ET && "Unknown float type");
APInt API = APF.bitcastToAPInt();

// First print a comment with what we think the original floating-point value
// should have been.
if (AP.isVerbose()) {
SmallString<8> StrVal;
APF.toString(StrVal);

if (ET)
ET->print(AP.OutStreamer->GetCommentOS());
else
AP.OutStreamer->GetCommentOS() << "Printing <null> Type";
ET->print(AP.OutStreamer->GetCommentOS());
AP.OutStreamer->GetCommentOS() << ' ' << StrVal << '\n';
}

Expand Down

0 comments on commit 369d16a

Please sign in to comment.