Skip to content

Commit 498da62

Browse files
committed
[NFC] [clang] add tests for merging of UsingShadowDecl
1 parent 3e023d8 commit 498da62

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

clang/test/Modules/cxx20-decls.cppm

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// RUN: rm -rf %t
2+
// RUN: split-file %s %t
3+
// RUN: cd %t
4+
//
5+
// RUN: %clang_cc1 -std=c++20 -I %t %t/A.cppm -emit-module-interface -o %t/A.pcm -verify
6+
// 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
7+
8+
//--- foo.h
9+
namespace baz {
10+
using foo = char;
11+
using baz::foo;
12+
}
13+
14+
//--- A.cppm
15+
// expected-no-diagnostics
16+
module;
17+
#include "foo.h"
18+
export module A;
19+
20+
//--- B.cpp
21+
// expected-no-diagnostics
22+
#include "foo.h"
23+
import A;
24+
// Since modules are loaded lazily, force loading by performing a lookup.
25+
using xxx = baz::foo;
26+
27+
// CHECK-LABEL: Dumping baz:
28+
// CHECK-NEXT: NamespaceDecl 0x[[BAZ_REDECL_ADDR:[^ ]*]] prev 0x[[BAZ_ADDR:[^ ]*]]
29+
// CHECK: TypeAliasDecl 0x[[ALIAS_REDECL_ADDR:[^ ]*]] prev 0x[[ALIAS_ADDR:[^ ]*]]
30+
// FIXME: UsingShadowDecl should have been merged
31+
// CHECK: UsingShadowDecl 0x{{[^ ]*}} <{{.*}}> col:{{.*}} imported in A.<global> hidden implicit TypeAlias 0x[[ALIAS_REDECL_ADDR]] 'foo'
32+
33+
// CHECK-LABEL: Dumping baz:
34+
// CHECK-NEXT: NamespaceDecl 0x[[BAZ_ADDR]] <{{.*}}> line:{{.*}} baz
35+
// CHECK: UsingShadowDecl 0x[[SHADOW_ADDR:[^ ]*]] <{{.*}}> col:{{.*}} implicit TypeAlias 0x[[ALIAS_ADDR]] 'foo'

0 commit comments

Comments
 (0)