This revision was not accepted when it landed; it landed in state "Changes 
Planned".
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf82df0b285ac: [C++20] [Modules] Use CanonicalType for base 
classes (authored by ChuanqiXu).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154324/new/

https://reviews.llvm.org/D154324

Files:
  clang/lib/AST/ODRHash.cpp
  clang/test/Modules/pr63595.cppm


Index: clang/test/Modules/pr63595.cppm
===================================================================
--- /dev/null
+++ clang/test/Modules/pr63595.cppm
@@ -0,0 +1,44 @@
+// RUN: rm -rf %t
+// RUN: mkdir %t
+// RUN: split-file %s %t
+//
+// RUN: %clang_cc1 -std=c++20 -emit-module-interface -I%t %t/module1.cppm -o 
%t/module1.pcm
+// RUN: %clang_cc1 -std=c++20 -emit-module-interface -I%t %t/module2.cppm -o 
%t/module2.pcm
+// RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/merge.cpp -verify 
-fsyntax-only
+
+//--- header.h
+namespace NS {
+template <int I>
+class A {
+};
+
+template <template <int I_> class T>
+class B {
+};
+}
+
+//--- module1.cppm
+// inside NS, using C = B<A>
+module;
+export module module1;
+#include "header.h"
+namespace NS {
+using C = B<A>;
+}
+export struct D : NS::C {};
+
+//--- module2.cppm
+// inside NS, using C = B<NS::A>
+module;
+export module module2;
+#include "header.h"
+namespace NS {
+using C = B<NS::A>;
+}
+export struct D : NS::C {};
+
+//--- merge.cpp
+// expected-no-diagnostics
+import module1;
+import module2;
+D d;
Index: clang/lib/AST/ODRHash.cpp
===================================================================
--- clang/lib/AST/ODRHash.cpp
+++ clang/lib/AST/ODRHash.cpp
@@ -593,7 +593,7 @@
   ID.AddInteger(Record->getNumBases());
   auto Bases = Record->bases();
   for (const auto &Base : Bases) {
-    AddQualType(Base.getType());
+    AddQualType(Base.getType().getCanonicalType());
     ID.AddInteger(Base.isVirtual());
     ID.AddInteger(Base.getAccessSpecifierAsWritten());
   }


Index: clang/test/Modules/pr63595.cppm
===================================================================
--- /dev/null
+++ clang/test/Modules/pr63595.cppm
@@ -0,0 +1,44 @@
+// RUN: rm -rf %t
+// RUN: mkdir %t
+// RUN: split-file %s %t
+//
+// RUN: %clang_cc1 -std=c++20 -emit-module-interface -I%t %t/module1.cppm -o %t/module1.pcm
+// RUN: %clang_cc1 -std=c++20 -emit-module-interface -I%t %t/module2.cppm -o %t/module2.pcm
+// RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/merge.cpp -verify -fsyntax-only
+
+//--- header.h
+namespace NS {
+template <int I>
+class A {
+};
+
+template <template <int I_> class T>
+class B {
+};
+}
+
+//--- module1.cppm
+// inside NS, using C = B<A>
+module;
+export module module1;
+#include "header.h"
+namespace NS {
+using C = B<A>;
+}
+export struct D : NS::C {};
+
+//--- module2.cppm
+// inside NS, using C = B<NS::A>
+module;
+export module module2;
+#include "header.h"
+namespace NS {
+using C = B<NS::A>;
+}
+export struct D : NS::C {};
+
+//--- merge.cpp
+// expected-no-diagnostics
+import module1;
+import module2;
+D d;
Index: clang/lib/AST/ODRHash.cpp
===================================================================
--- clang/lib/AST/ODRHash.cpp
+++ clang/lib/AST/ODRHash.cpp
@@ -593,7 +593,7 @@
   ID.AddInteger(Record->getNumBases());
   auto Bases = Record->bases();
   for (const auto &Base : Bases) {
-    AddQualType(Base.getType());
+    AddQualType(Base.getType().getCanonicalType());
     ID.AddInteger(Base.isVirtual());
     ID.AddInteger(Base.getAccessSpecifierAsWritten());
   }
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to