[PATCH] D114769: [C++20] [Modules] [Concepts] Recognize same concepts more precisely in Serialization
Chuanqi Xu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 29 22:31:15 PST 2021
ChuanqiXu updated this revision to Diff 390572.
ChuanqiXu added a comment.
Clean code.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114769/new/
https://reviews.llvm.org/D114769
Files:
clang/lib/Serialization/ASTReaderDecl.cpp
clang/test/Modules/Inputs/concept/A.cppm
clang/test/Modules/Inputs/concept/foo.h
clang/test/Modules/concept.cppm
Index: clang/test/Modules/concept.cppm
===================================================================
--- /dev/null
+++ clang/test/Modules/concept.cppm
@@ -0,0 +1,10 @@
+// RUN: rm -rf %t
+// RUN: mkdir %t
+// RUN: %clang -std=c++20 %S/Inputs/concept/A.cppm --precompile -o %t/A.pcm
+// RUN: %clang -std=c++20 -fprebuilt-module-path=%t -I%S/Inputs/concept %s -c -Xclang -verify
+// expected-no-diagnostics
+
+module;
+#include "foo.h"
+export module B;
+import A;
Index: clang/test/Modules/Inputs/concept/foo.h
===================================================================
--- /dev/null
+++ clang/test/Modules/Inputs/concept/foo.h
@@ -0,0 +1,13 @@
+#ifndef FOO_H
+#define FOO_H
+
+template< class T >
+concept Range = requires(T& t) { t.begin(); };
+
+struct A {
+ public:
+ template <Range T>
+ using range_type = T;
+};
+
+#endif
Index: clang/test/Modules/Inputs/concept/A.cppm
===================================================================
--- /dev/null
+++ clang/test/Modules/Inputs/concept/A.cppm
@@ -0,0 +1,3 @@
+module;
+#include "foo.h"
+export module A;
Index: clang/lib/Serialization/ASTReaderDecl.cpp
===================================================================
--- clang/lib/Serialization/ASTReaderDecl.cpp
+++ clang/lib/Serialization/ASTReaderDecl.cpp
@@ -2948,6 +2948,7 @@
static bool isSameTemplateParameterList(const ASTContext &C,
const TemplateParameterList *X,
const TemplateParameterList *Y);
+static bool isSameEntity(NamedDecl *X, NamedDecl *Y);
/// Determine whether two template parameters are similar enough
/// that they may be used in declarations of the same template.
@@ -2967,7 +2968,7 @@
if (!TXTC != !TYTC)
return false;
if (TXTC && TYTC) {
- if (TXTC->getNamedConcept() != TYTC->getNamedConcept())
+ if (!isSameEntity(TXTC->getNamedConcept(), TYTC->getNamedConcept()))
return false;
if (TXTC->hasExplicitTemplateArgs() != TYTC->hasExplicitTemplateArgs())
return false;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114769.390572.patch
Type: text/x-patch
Size: 2081 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211130/31e46ca5/attachment.bin>
More information about the cfe-commits
mailing list