diff options
author | Matheus Izvekov <mizvekov@gmail.com> | 2024-05-21 20:27:50 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-21 20:27:50 -0300 |
commit | e42b799bb28815431f2c5a95f7e13fde3f1b36a1 (patch) | |
tree | bb6d81d96bbac27b9455b5f1dd70fed08b15911a /clang-tools-extra/clang-tidy/modernize/UseConstraintsCheck.cpp | |
parent | b90861498b5b5c06ba24a122b6987738560acf99 (diff) | |
download | llvm-e42b799bb28815431f2c5a95f7e13fde3f1b36a1.zip llvm-e42b799bb28815431f2c5a95f7e13fde3f1b36a1.tar.gz llvm-e42b799bb28815431f2c5a95f7e13fde3f1b36a1.tar.bz2 |
[clang] NFCI: use TemplateArgumentLoc for type-param DefaultArgument (#92854)
This is an enabler for a future patch.
This allows an type-parameter default argument to be set as an arbitrary
TemplateArgument, not just a type.
This allows template parameter packs to have default arguments in the
AST, even though the language proper doesn't support the syntax for it.
This will be used in a later patch which synthesizes template parameter
lists with arbitrary default arguments taken from template
specializations.
There are a few places we used SubsType, because we only had a type, now
we use SubstTemplateArgument.
SubstTemplateArgument was missing arguments for setting Instantiation
location and entity names.
Adding those is needed so we don't regress in diagnostics.
Diffstat (limited to 'clang-tools-extra/clang-tidy/modernize/UseConstraintsCheck.cpp')
-rw-r--r-- | clang-tools-extra/clang-tidy/modernize/UseConstraintsCheck.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/clang-tools-extra/clang-tidy/modernize/UseConstraintsCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseConstraintsCheck.cpp index 7a021fe..ea4d995 100644 --- a/clang-tools-extra/clang-tidy/modernize/UseConstraintsCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/UseConstraintsCheck.cpp @@ -177,9 +177,11 @@ matchTrailingTemplateParam(const FunctionTemplateDecl *FunctionTemplate) { dyn_cast<TemplateTypeParmDecl>(LastParam)) { if (LastTemplateParam->hasDefaultArgument() && LastTemplateParam->getIdentifier() == nullptr) { - return {matchEnableIfSpecialization( - LastTemplateParam->getDefaultArgumentInfo()->getTypeLoc()), - LastTemplateParam}; + return { + matchEnableIfSpecialization(LastTemplateParam->getDefaultArgument() + .getTypeSourceInfo() + ->getTypeLoc()), + LastTemplateParam}; } } return {}; |