aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2025-05-22 23:50:58 -0700
committerGitHub <noreply@github.com>2025-05-22 23:50:58 -0700
commitcc78177e8f50f1d217b2fba5677fc1664aabd91e (patch)
tree29723bff7e4aa91ccee9c273b9a5b4172e6e1822 /llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
parent05674b21fed51a940b93e09b38d1833010f3f694 (diff)
downloadllvm-cc78177e8f50f1d217b2fba5677fc1664aabd91e.zip
llvm-cc78177e8f50f1d217b2fba5677fc1664aabd91e.tar.gz
llvm-cc78177e8f50f1d217b2fba5677fc1664aabd91e.tar.bz2
[llvm] Use *Map::try_emplace (NFC) (#141190)
try_emplace can default-construct values, so we do not need to do so on our own. Plus, try_emplace(Key) is much simpler/shorter than insert({Key, LongValueType()}).
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
index df4e4857..fc43bc6 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -234,7 +234,7 @@ unsigned CodeViewDebug::maybeRecordFile(const DIFile *F) {
CodeViewDebug::InlineSite &
CodeViewDebug::getInlineSite(const DILocation *InlinedAt,
const DISubprogram *Inlinee) {
- auto SiteInsertion = CurFn->InlineSites.insert({InlinedAt, InlineSite()});
+ auto SiteInsertion = CurFn->InlineSites.try_emplace(InlinedAt);
InlineSite *Site = &SiteInsertion.first->second;
if (SiteInsertion.second) {
unsigned ParentFuncId = CurFn->FuncId;
@@ -2743,7 +2743,7 @@ TypeIndex CodeViewDebug::getCompleteTypeIndex(const DIType *Ty) {
// Check if we've already translated the complete record type.
// Insert the type with a null TypeIndex to signify that the type is currently
// being lowered.
- auto InsertResult = CompleteTypeIndices.insert({CTy, TypeIndex()});
+ auto InsertResult = CompleteTypeIndices.try_emplace(CTy);
if (!InsertResult.second)
return InsertResult.first->second;
@@ -3005,7 +3005,7 @@ void CodeViewDebug::collectLexicalBlockInfo(
// Create a new CodeView lexical block for this lexical scope. If we've
// seen this DILexicalBlock before then the scope tree is malformed and
// we can handle this gracefully by not processing it a second time.
- auto BlockInsertion = CurFn->LexicalBlocks.insert({DILB, LexicalBlock()});
+ auto BlockInsertion = CurFn->LexicalBlocks.try_emplace(DILB);
if (!BlockInsertion.second)
return;