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) {
284284 if (!RD->isCompleteDefinition ())
285285 return nullptr ;
286286
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)
289292 return It->second ;
290293
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-
296294 // Number of bytes required by fields and base classes.
297295 unsigned BaseSize = 0 ;
298296 // Number of bytes required by virtual base.
You can’t perform that action at this time.
0 commit comments