Skip to content

Commit b768773

Browse files
authored
Fix for ParseChecksum function (#1021)
* Fix for ParseChecksum function This is a patch to fix failure, caused by bringing as argument of ParseChecksum StringRef with non-zero length, but with empty data.
1 parent efa761b commit b768773

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/SPIRV/SPIRVToLLVMDbgTran.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,8 +1007,11 @@ DIFile *SPIRVToLLVMDbgTran::getFile(const SPIRVId SourceId) {
10071007
"DebugSource instruction is expected");
10081008
SPIRVWordVec SourceArgs = Source->getArguments();
10091009
assert(SourceArgs.size() == OperandCount && "Invalid number of operands");
1010-
StringRef Checksum(getString(SourceArgs[TextIdx]));
1011-
return getDIFile(getString(SourceArgs[FileIdx]), ParseChecksum(Checksum));
1010+
std::string ChecksumStr =
1011+
getDbgInst<SPIRVDebug::DebugInfoNone>(SourceArgs[TextIdx])
1012+
? ""
1013+
: getString(SourceArgs[TextIdx]);
1014+
return getDIFile(getString(SourceArgs[FileIdx]), ParseChecksum(ChecksumStr));
10121015
}
10131016

10141017
SPIRVToLLVMDbgTran::SplitFileName::SplitFileName(const string &FileName) {

0 commit comments

Comments
 (0)