Page MenuHomePhabricator

[lldb] Unify the two CreateTypedef implementations in TypeSystemClang

Authored by teemperor on Dec 16 2020, 1:20 AM.



To get LLDB one step closer to fulfil the software redundancy requirements of modern aircrafts,
we apparently decided to have two separately maintained implementations of CreateTypedef
in TypeSystemClang. Let's pass on the idea of an LLDB-powered jetliner and deleted one implementation.

On a more serious note: This function got duplicated a long time ago when the idea of CompilerType
with a backing TypeSystemClang subclass happened (56939cb31061d24ae3d1fc62da38b57e78bb2556).
One implementation was supposed to be called from CompilerType::CreateTypedef and the other has
just always been around to create typedefs. By accident one of the implementations is only used by
the PDB parser while the CompilerType::CreateTypedef backend is used by the rest of LLDB.

We also had some patches over the year that only fixed one of the two functions (D18099 for example
only fixed up the CompilerType::CreateTypedef implementation). D51162 and D86140 both fixed
the same missing addDecl call for one of the two implementations.

This patch:

  • deletes the CreateTypedefType function as its only used by the PDB parser and the CreateTypedef

implementation is anyway needed as it's the backend implementation of CompilerType.

  • replaces the calls in the PDB parser by just calling the CompilerType wrapper.
  • moves the documentation to the remaining function.
  • moves the check for empty typedef names that was only in the deleted implementation to the other (I don't think this fixes anything as I believe all callers are already doing the same check).

I'll fix up the usual stuff (not using StringRef, not doing early exit) in a NFC follow-up.

This patch is not NFC as the PDB parser now calls the function that has the fix from D18099.

Diff Detail

Event Timeline

teemperor requested review of this revision.Dec 16 2020, 1:20 AM
teemperor created this revision.
JDevlieghere accepted this revision.Dec 16 2020, 2:53 PM

+1 on scrapping the jetliner idea.

LGTM if the Windows bot agrees that this is NFC.

This revision is now accepted and ready to land.Dec 16 2020, 2:53 PM
labath accepted this revision.Dec 17 2020, 12:28 AM

I wouldn't dismiss the jetliner idea completely. With all the recent upsets in the aviation industry, there may be an opening for us yet. :P

Herald added a project: Restricted Project. · View Herald TranscriptDec 17 2020, 1:49 AM