File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -284,15 +284,13 @@ Record *Program::getOrCreateRecord(const RecordDecl *RD) {
284
284
if (!RD->isCompleteDefinition ())
285
285
return nullptr ;
286
286
287
- // Deduplicate records.
288
- if (auto It = Records.find (RD); It != Records.end ())
287
+ // Return an existing record if available. Otherwise, we insert nullptr now
288
+ // and replace that later, so recursive calls to this function with the same
289
+ // RecordDecl don't run into infinite recursion.
290
+ auto [It, Inserted] = Records.try_emplace (RD);
291
+ if (!Inserted)
289
292
return It->second ;
290
293
291
- // We insert nullptr now and replace that later, so recursive calls
292
- // to this function with the same RecordDecl don't run into
293
- // infinite recursion.
294
- Records.insert ({RD, nullptr });
295
-
296
294
// Number of bytes required by fields and base classes.
297
295
unsigned BaseSize = 0 ;
298
296
// Number of bytes required by virtual base.
You can’t perform that action at this time.
0 commit comments