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:
- Inlines ParseClassTemplateDecl logic into the DWARF parser where its only use is.
- 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).
name.split('<').first ?