This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Delete TypeSystemClang::ParseClassTemplateDecl
AcceptedPublic

Authored by teemperor on Nov 5 2021, 7:00 AM.

Details

Reviewers
labath
shafik
Summary

ParseClassTemplateDecl is a leftover from the old days where the TypeSystemClang
predecessor was still doing DWARF parsing. Right now the function just checks that the passed
template args are valid (and returns null if they aren't). It also strips the parameters from the
name<parameter> name (because that's how the DW_AT_name field is filled out by most compilers).

This patch:

  1. Inlines ParseClassTemplateDecl logic into the DWARF parser where its only use is.
  2. Inside the if (ParseTemplateParameterInfos(...)) scope we know that the template parameters are valid because the function returns args.IsValid(). So we can drop all the unreachable error handling code or replace it with asserts.

There is one non-NFC part in here. ParseTemplateParameterInfos is
supposed to return true if the template args are valid. However the old
implementation just had an outdated copy of the IsValid implementation that
wasn't updated alongside IsValid. This just replaces this with a call to IsValid
which means that some template DIEs that can't be parsed are now handled
by the standard error handling code (aka, turning it into a fake class) and not
the removed log-and-return-null error handling.

The only reason for that change is that we want to know for sure that in
if (ParseTemplateParameterInfos(...)) we have valid template args (and don't
need any other additional error handling).

Diff Detail

Event Timeline

teemperor created this revision.Nov 5 2021, 7:00 AM
teemperor requested review of this revision.Nov 5 2021, 7:00 AM
teemperor edited the summary of this revision. (Show Details)
teemperor edited the summary of this revision. (Show Details)Nov 5 2021, 7:10 AM
labath accepted this revision.Nov 5 2021, 7:15 AM
labath added inline comments.
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
1769

name.split('<').first ?

This revision is now accepted and ready to land.Nov 5 2021, 7:15 AM
teemperor added inline comments.Nov 5 2021, 7:25 AM
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
1769

jepp, thanks!