[PATCH] D116911: [AST] Don't consider 'ExportDecl' when calculating DeclContext 'Encloses'
Chuanqi Xu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 10 17:55:47 PST 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG86c5b870b2e5: [AST] Don't consider 'ExportDecl' when calculating DeclContext 'Encloses' (authored by ChuanqiXu).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D116911/new/
https://reviews.llvm.org/D116911
Files:
clang/lib/AST/DeclBase.cpp
clang/test/SemaCXX/lookup-through-export.cpp
Index: clang/test/SemaCXX/lookup-through-export.cpp
===================================================================
--- /dev/null
+++ clang/test/SemaCXX/lookup-through-export.cpp
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -std=c++20 %s -verify
+
+// expected-no-diagnostics
+export module X;
+export {
+ namespace A {
+ namespace B {
+ int bar;
+ }
+ } // namespace A
+ namespace C {
+ void foo() {
+ using namespace A;
+ (void)B::bar;
+ }
+ } // namespace C
+}
+
+export {
+ namespace D {
+ namespace E {
+ int bar;
+ }
+ } // namespace D
+ namespace F {
+ void foo() {
+ using namespace D;
+ (void)E::bar;
+ }
+ } // namespace F
+}
Index: clang/lib/AST/DeclBase.cpp
===================================================================
--- clang/lib/AST/DeclBase.cpp
+++ clang/lib/AST/DeclBase.cpp
@@ -1212,7 +1212,8 @@
return getPrimaryContext()->Encloses(DC);
for (; DC; DC = DC->getParent())
- if (!isa<LinkageSpecDecl>(DC) && DC->getPrimaryContext() == this)
+ if (!isa<LinkageSpecDecl>(DC) && !isa<ExportDecl>(DC) &&
+ DC->getPrimaryContext() == this)
return true;
return false;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116911.398795.patch
Type: text/x-patch
Size: 1148 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220111/e37df6be/attachment.bin>
More information about the cfe-commits
mailing list