aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaLookup.cpp
diff options
context:
space:
mode:
authorMatheus Izvekov <mizvekov@gmail.com>2025-04-12 14:26:30 -0300
committerGitHub <noreply@github.com>2025-04-12 14:26:30 -0300
commit761787d42576751afbaaba5107233ee849f81b6f (patch)
tree4b2adfc8b7283d0e26bfe3bc591d8d1ea751dfbc /clang/lib/Sema/SemaLookup.cpp
parent009971a0d3218d3af0d10fb70d2c876ccc46b24d (diff)
downloadllvm-761787d42576751afbaaba5107233ee849f81b6f.zip
llvm-761787d42576751afbaaba5107233ee849f81b6f.tar.gz
llvm-761787d42576751afbaaba5107233ee849f81b6f.tar.bz2
Reland: [clang] Improved canonicalization for template specialization types (#135414)
This relands https://github.com/llvm/llvm-project/pull/135119, after fixing crashes seen in LLDB CI reported here: https://github.com/llvm/llvm-project/pull/135119#issuecomment-2794910840 Fixes https://github.com/llvm/llvm-project/pull/135119 This changes the TemplateArgument representation to hold a flag indicating whether a tempalte argument of expression type is supposed to be canonical or not. This gets one step closer to solving https://github.com/llvm/llvm-project/issues/92292 This still doesn't try to unique as-written TSTs. While this would increase the amount of memory savings and make code dealing with the AST more well-behaved, profiling template argument lists is still too expensive for this to be worthwhile, at least for now. This also fixes the context creation of TSTs, so that they don't in some cases get incorrectly flagged as sugar over their own canonical form. This is captured in the test expectation change of some AST dumps. This fixes some places which were unnecessarily canonicalizing these TSTs.
Diffstat (limited to 'clang/lib/Sema/SemaLookup.cpp')
-rw-r--r--clang/lib/Sema/SemaLookup.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp
index a77ca77..5813460 100644
--- a/clang/lib/Sema/SemaLookup.cpp
+++ b/clang/lib/Sema/SemaLookup.cpp
@@ -3713,7 +3713,8 @@ Sema::LookupLiteralOperator(Scope *S, LookupResult &R,
if (StringLit) {
SFINAETrap Trap(*this);
CheckTemplateArgumentInfo CTAI;
- TemplateArgumentLoc Arg(TemplateArgument(StringLit), StringLit);
+ TemplateArgumentLoc Arg(
+ TemplateArgument(StringLit, /*IsCanonical=*/false), StringLit);
if (CheckTemplateArgument(
Params->getParam(0), Arg, FD, R.getNameLoc(), R.getNameLoc(),
/*ArgumentPackIndex=*/0, CTAI, CTAK_Specified) ||