This is an archive of the discontinued LLVM Phabricator instance.

Separate DIERef vs. user_id_t: GetForwardDeclClangTypeToDie()
ClosedPublic

Authored by jankratochvil on Feb 16 2020, 6:50 AM.

Diff Detail

Event Timeline

jankratochvil created this revision.Feb 16 2020, 6:50 AM

The thing I said on the other patch about DIERef vs user_id_t still applies. Let's continue the discussion there...

lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
37 ↗(On Diff #244873)

I'd very much like to avoid a default-constructed DIERef -- in the previous refactoring, I've deleted that concept and tried to use Optional<DIERef> in contexts, where the object can be empty.

Per discussion on the other patch, I think this is fine too, just can we get rid of the DIERef default constructor? I think all you'd need is to use the insert DenseMap function instead of operator[].

jankratochvil marked an inline comment as done.

Sorry for that DenseMap::insert, I see it is the same as std::map, I should study DenseMap more.

labath accepted this revision.Feb 18 2020, 2:08 AM

Sorry for that DenseMap::insert, I see it is the same as std::map, I should study DenseMap more.

Yep, it tried to be similar to std::map, but there are some (sometimes subtle) differences.

lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
1723–1725

Actually, try_emplace would be slightly better here. (Sorry for the back-and-forth :/).

This revision is now accepted and ready to land.Feb 18 2020, 2:08 AM
This revision was automatically updated to reflect the committed changes.