[PATCH] D87697: Do not construct std::string from nullptr
Yuriy Chernyshov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 5 01:17:08 PST 2020
georgthegreat updated this revision to Diff 303056.
georgthegreat added a comment.
Changed as dblaikie@ suggested. Not all the types are handled during the switch, so default is still required in order to prevent compiler from issuing warnings.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D87697/new/
https://reviews.llvm.org/D87697
Files:
llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
Index: llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
===================================================================
--- llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
+++ llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
@@ -1272,9 +1272,6 @@
std::string
NVPTXAsmPrinter::getPTXFundamentalTypeStr(Type *Ty, bool useB4PTR) const {
switch (Ty->getTypeID()) {
- default:
- llvm_unreachable("unexpected type");
- break;
case Type::IntegerTyID: {
unsigned NumBits = cast<IntegerType>(Ty)->getBitWidth();
if (NumBits == 1)
@@ -1305,9 +1302,10 @@
return "b32";
else
return "u32";
+ default:
+ break;
}
llvm_unreachable("unexpected type");
- return nullptr;
}
void NVPTXAsmPrinter::emitPTXGlobalVariable(const GlobalVariable *GVar,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87697.303056.patch
Type: text/x-patch
Size: 770 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201105/950a140e/attachment.bin>
More information about the llvm-commits
mailing list