diff options
| author | Krystian Stasiowski <sdkrystian@gmail.com> | 2024-05-07 14:45:52 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-07 14:45:52 -0400 |
| commit | 7115ed0fff027b65fa76fdfae215ed1382ed1473 (patch) | |
| tree | 05fcb20f501954053c368ff5266a8fc446638d4c /llvm/lib/Bitcode/Reader/BitcodeReader.cpp | |
| parent | 1a2a1fbd7c03381fe5e4f459f7081bef13366ef4 (diff) | |
[Clang] Unify interface for accessing template arguments as written for class/variable template specializations (#81642)
Our current method of storing the template arguments as written for
`(Class/Var)Template(Partial)SpecializationDecl` suffers from a number
of flaws:
- We use `TypeSourceInfo` to store `TemplateArgumentLocs` for class
template/variable template partial/explicit specializations. For
variable template specializations, this is a rather unintuitive hack (as
we store a non-type specialization as a type). Moreover, we don't ever
*need* the type as written -- in almost all cases, we only want the
template arguments (e.g. in tooling use-cases).
- The template arguments as written are stored in a number of redundant
data members. For example, `(Class/Var)TemplatePartialSpecialization`
have their own `ArgsAsWritten` member that stores an
`ASTTemplateArgumentListInfo` (the template arguments).
`VarTemplateSpecializationDecl` has yet _another_ redundant member
"`TemplateArgsInfo`" that also stores an `ASTTemplateArgumentListInfo`.
This patch eliminates all
`(Class/Var)Template(Partial)SpecializationDecl` members which store the
template arguments as written, and turns the `ExplicitInfo` member into
a `llvm::PointerUnion<const ASTTemplateArgumentListInfo*,
ExplicitInstantiationInfo*>` (to avoid unnecessary allocations when the
declaration isn't an explicit instantiation). The template arguments as
written are now accessed via `getTemplateArgsWritten` in all cases.
The "most breaking" change is to AST Matchers, insofar that `hasTypeLoc`
will no longer match class template specializations (since they no
longer store the type as written).
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
0 files changed, 0 insertions, 0 deletions
