serge-sans-paille added inline comments.

================
Comment at: clang/lib/AST/Decl.cpp:1099
+    const DeclContext *CurrentContext = getDeclContext();
+    while (true) {
+      if (isa<TranslationUnitDecl>(CurrentContext))
----------------
aaron.ballman wrote:
> Rather than trying to manually decide whether the name will be exposed at the 
> top level, I wonder if we should use `Sema::LookupName()` to try to find the 
> name in the global scope. That would move this code from `AST` into `Sema` to 
> avoid layering issues, so it'd be something more like `bool 
> Sema::IsDeclReserved(const NamedDecl *ND) const` or `bool 
> Sema::IsIdentifierReserved(const IdentifierInfo *II) const`.
> 
> The idea is to perform the lookup in global scope and if the lookup finds the 
> identifier, then regardless of how it got there (anonymous union field, 
> anonymous namespaces, enumeration constants, etc), we know it may conflict 
> with an external declaration and diagnose.
> 
> WDYT?
That's an interesting proposal.Let me try that!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93095/new/

https://reviews.llvm.org/D93095

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to