[PATCH] D112481: [Sema] fix nondeterminism in ASTContext::getDeducedTemplateSpecializationType
Wei Wang via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 19 13:30:35 PST 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa075d6722283: [Sema] fix nondeterminism in ASTContext::getDeducedTemplateSpecializationType (authored by weiwang).
Changed prior to commit:
https://reviews.llvm.org/D112481?vs=382375&id=388616#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D112481/new/
https://reviews.llvm.org/D112481
Files:
clang/include/clang/AST/Type.h
clang/lib/AST/ASTContext.cpp
Index: clang/lib/AST/ASTContext.cpp
===================================================================
--- clang/lib/AST/ASTContext.cpp
+++ clang/lib/AST/ASTContext.cpp
@@ -5676,6 +5676,9 @@
auto *DTST = new (*this, TypeAlignment)
DeducedTemplateSpecializationType(Template, DeducedType, IsDependent);
+ llvm::FoldingSetNodeID TempID;
+ DTST->Profile(TempID);
+ assert(ID == TempID && "ID does not match");
Types.push_back(DTST);
DeducedTemplateSpecializationTypes.InsertNode(DTST, InsertPos);
return QualType(DTST, 0);
Index: clang/include/clang/AST/Type.h
===================================================================
--- clang/include/clang/AST/Type.h
+++ clang/include/clang/AST/Type.h
@@ -5073,8 +5073,10 @@
static void Profile(llvm::FoldingSetNodeID &ID, TemplateName Template,
QualType Deduced, bool IsDependent) {
Template.Profile(ID);
- ID.AddPointer(Deduced.getAsOpaquePtr());
- ID.AddBoolean(IsDependent);
+ QualType CanonicalType =
+ Deduced.isNull() ? Deduced : Deduced.getCanonicalType();
+ ID.AddPointer(CanonicalType.getAsOpaquePtr());
+ ID.AddBoolean(IsDependent || Template.isDependent());
}
static bool classof(const Type *T) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112481.388616.patch
Type: text/x-patch
Size: 1239 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211119/70f136ad/attachment.bin>
More information about the cfe-commits
mailing list