[clang] [C] Diagnose declarations hidden in C++ (PR #137368)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 28 10:52:01 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:

Makes sense to me, I'm fine with the rest of it in a followup.

https://github.com/llvm/llvm-project/pull/137368


More information about the cfe-commits mailing list