[clang] [C] Diagnose declarations hidden in C++ (PR #137368)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 28 10:39:14 PDT 2025
================
@@ -1428,6 +1428,17 @@ bool DeclContext::Encloses(const DeclContext *DC) const {
return false;
}
+bool DeclContext::LexicallyEncloses(const DeclContext *DC) const {
+ if (getPrimaryContext() != this)
+ return getPrimaryContext()->LexicallyEncloses(DC);
+
+ for (; DC; DC = DC->getLexicalParent())
+ if (!isa<LinkageSpecDecl>(DC) && !isa<ExportDecl>(DC) &&
----------------
erichkeane wrote:
```suggestion
if (!isa<LinkageSpecDecl, ExportDecl>(DC) &&
```
That said... Perhaps we should just do a
```
if (isa<LinkageSpecDecl, ExportDecl>(*this)) return false;
```
?? Since thats the only way the equivilence would work?
https://github.com/llvm/llvm-project/pull/137368
More information about the cfe-commits
mailing list