[PATCH 51/79] [DebugInfo] Fix translation of DebugSource Text argument (#2003)
authorViktoria Maximova <viktoria.maksimova@intel.com>
Tue, 9 May 2023 17:40:14 +0000 (10:40 -0700)
committerAndreas Beckmann <anbe@debian.org>
Thu, 8 Feb 2024 21:48:18 +0000 (22:48 +0100)
Handle the case when we have `DebugInfoNone` for the Text argument
which is usually expected to be `OpString`.

Gbp-Pq: Name 0051-DebugInfo-Fix-translation-of-DebugSource-Text-argume.patch

lib/SPIRV/SPIRVToLLVMDbgTran.cpp

index 5d58e81e3a0333d469c65fbd8cacf2f4fd7a9753..fcbf47e0a9919eec61c6ca12464aea1ae5bfa612 100644 (file)
@@ -144,6 +144,8 @@ const std::string &SPIRVToLLVMDbgTran::getString(const SPIRVId Id) {
 Optional<std::string>
 SPIRVToLLVMDbgTran::getStringContinued(const SPIRVId Id,
                                        SPIRVExtInst *DebugInst) {
+  if (getDbgInst<SPIRVDebug::DebugInfoNone>(Id))
+    return std::string();
   std::string Str = BM->get<SPIRVString>(Id)->getStr();
   using namespace SPIRVDebug::Operand::SourceContinued;
   for (auto *I : DebugInst->getContinuedInstructions()) {