[clang] [C] Diagnose declarations hidden in C++ (PR #137368)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 28 10:49:48 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) &&
----------------
AaronBallman wrote:
This code was lifted from `DeclContext::Encloses()`, so the cleanup is easy because it doesn't change logic between the two functions. I'll clean that up, but other changes should be done in a follow-up so they're done consistently (if done at all). WDYT?
https://github.com/llvm/llvm-project/pull/137368
More information about the cfe-commits
mailing list