mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-27 07:31:28 +00:00
[AST] Don't consider 'ExportDecl' when calculating DeclContext 'Encloses'
This mimics the style of 90010c2e1
(Don't consider 'LinkageSpec' when
calculating DeclContext 'Encloses'). Since ExportDecl and LinkageSpec
are transparent DeclContext, they share some similarity.
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D116911
This commit is contained in:
parent
63f0c00d38
commit
86c5b870b2
@ -1212,7 +1212,8 @@ bool DeclContext::Encloses(const DeclContext *DC) const {
|
||||
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;
|
||||
}
|
||||
|
31
clang/test/SemaCXX/lookup-through-export.cpp
Normal file
31
clang/test/SemaCXX/lookup-through-export.cpp
Normal file
@ -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
|
||||
}
|
Loading…
Reference in New Issue
Block a user