[clang] 498da62 - [NFC] [clang] add tests for merging of UsingShadowDecl

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Wed May 29 22:57:45 PDT 2024


Author: Matheus Izvekov
Date: 2024-05-30T02:56:57-03:00
New Revision: 498da62088b22ef1d4e90d6021a80ae7bab6abae

URL: https://github.com/llvm/llvm-project/commit/498da62088b22ef1d4e90d6021a80ae7bab6abae
DIFF: https://github.com/llvm/llvm-project/commit/498da62088b22ef1d4e90d6021a80ae7bab6abae.diff

LOG: [NFC] [clang] add tests for merging of UsingShadowDecl

Added: 
    clang/test/Modules/cxx20-decls.cppm

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/clang/test/Modules/cxx20-decls.cppm b/clang/test/Modules/cxx20-decls.cppm
new file mode 100644
index 0000000000000..9f0c40685b68f
--- /dev/null
+++ b/clang/test/Modules/cxx20-decls.cppm
@@ -0,0 +1,35 @@
+// RUN: rm -rf %t
+// RUN: split-file %s %t
+// RUN: cd %t
+//
+// RUN: %clang_cc1 -std=c++20 -I %t %t/A.cppm -emit-module-interface -o %t/A.pcm -verify
+// RUN: %clang_cc1 -std=c++20 -I %t %t/B.cpp -fmodule-file=A=%t/A.pcm -fsyntax-only -verify -ast-dump-all -ast-dump-filter baz | FileCheck %s
+
+//--- foo.h
+namespace baz {
+  using foo = char;
+  using baz::foo;
+}
+
+//--- A.cppm
+// expected-no-diagnostics
+module;
+#include "foo.h"
+export module A;
+
+//--- B.cpp
+// expected-no-diagnostics
+#include "foo.h"
+import A;
+// Since modules are loaded lazily, force loading by performing a lookup.
+using xxx = baz::foo;
+
+// CHECK-LABEL: Dumping baz:
+// CHECK-NEXT: NamespaceDecl 0x[[BAZ_REDECL_ADDR:[^ ]*]] prev 0x[[BAZ_ADDR:[^ ]*]]
+// CHECK:      TypeAliasDecl 0x[[ALIAS_REDECL_ADDR:[^ ]*]] prev 0x[[ALIAS_ADDR:[^ ]*]]
+// FIXME: UsingShadowDecl should have been merged
+// CHECK:      UsingShadowDecl 0x{{[^ ]*}} <{{.*}}> col:{{.*}} imported in A.<global> hidden implicit TypeAlias 0x[[ALIAS_REDECL_ADDR]] 'foo'
+
+// CHECK-LABEL: Dumping baz:
+// CHECK-NEXT: NamespaceDecl 0x[[BAZ_ADDR]] <{{.*}}> line:{{.*}} baz
+// CHECK:      UsingShadowDecl 0x[[SHADOW_ADDR:[^ ]*]] <{{.*}}> col:{{.*}} implicit TypeAlias 0x[[ALIAS_ADDR]] 'foo'


        


More information about the cfe-commits mailing list