aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
diff options
context:
space:
mode:
authorJonas Hahnfeld <jonas.hahnfeld@cern.ch>2022-12-01 14:14:43 +0100
committerJonas Hahnfeld <jonas.hahnfeld@cern.ch>2022-12-08 09:58:33 +0100
commitc9cb4fc761cd78d3a04feb211d363e91933a8e08 (patch)
treeb4b8eb077835ed56b452928875d5713281cc34c9 /llvm/lib/Bitcode/Reader/MetadataLoader.cpp
parent61318fa5c764d6af60baeb1c00d793f1bd95f5ea (diff)
downloadllvm-c9cb4fc761cd78d3a04feb211d363e91933a8e08.zip
llvm-c9cb4fc761cd78d3a04feb211d363e91933a8e08.tar.gz
llvm-c9cb4fc761cd78d3a04feb211d363e91933a8e08.tar.bz2
[DebugInfo] Store optional DIFile::Source as pointer
getCanonicalMDString() also returns a nullptr for empty strings, which tripped over the getSource() method. Solve the ambiguity of no source versus an optional containing a nullptr by simply storing a pointer. Differential Revision: https://reviews.llvm.org/D138658
Diffstat (limited to 'llvm/lib/Bitcode/Reader/MetadataLoader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/MetadataLoader.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
index 0f3ad25..96f436a 100644
--- a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
+++ b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
@@ -1621,11 +1621,10 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
Checksum.emplace(static_cast<DIFile::ChecksumKind>(Record[3]),
getMDString(Record[4]));
MetadataList.assignValue(
- GET_OR_DISTINCT(DIFile, (Context, getMDString(Record[1]),
- getMDString(Record[2]), Checksum,
- Record.size() > 5 ? std::optional<MDString *>(
- getMDString(Record[5]))
- : std::nullopt)),
+ GET_OR_DISTINCT(DIFile,
+ (Context, getMDString(Record[1]),
+ getMDString(Record[2]), Checksum,
+ Record.size() > 5 ? getMDString(Record[5]) : nullptr)),
NextMetadataNo);
NextMetadataNo++;
break;