[PATCH] D87697: Do not construct std::string from nullptr

Yuriy Chernyshov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 15 07:49:35 PDT 2020


georgthegreat created this revision.
georgthegreat added reviewers: mclow.lists, nikic.
Herald added subscribers: llvm-commits, hiraditya, kristof.beyls, jholewinski.
Herald added a project: LLVM.
georgthegreat requested review of this revision.

While I am trying to forbid such usages systematically in https://reviews.llvm.org/D79427 / P2166R0 to C++ standard, this PR fixes this (definitelly incorrect) usage in llvm.

This code is unreachable, so it could not cause any harm


Repository:
  rG LLVM Github Monorepo

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
@@ -1306,8 +1306,6 @@
     else
       return "u32";
   }
-  llvm_unreachable("unexpected type");
-  return nullptr;
 }

 void NVPTXAsmPrinter::emitPTXGlobalVariable(const GlobalVariable *GVar,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87697.291925.patch
Type: text/x-patch
Size: 403 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200915/4a551e41/attachment.bin>


More information about the llvm-commits mailing list