[clang] [Clang][Sema] Skip checking anonymous enum in using enum declaration (PR #87144)

Qizhi Hu via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 7 18:56:13 PDT 2024


================
@@ -1537,6 +1537,10 @@ void Sema::PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext) {
       cast<FunctionDecl>(D)->isFunctionTemplateSpecialization())
     return;
 
+  if (isa<UsingEnumDecl>(D) && D->getDeclName().isEmpty()) {
----------------
jcsxky wrote:

Ah, I see. I skip those checking when `D` is `using enum`(`UsingEnumDecl`) by adding
```cpp
if (isa<UsingEnumDecl>(D))
    return;
```
at https://github.com/llvm/llvm-project/blob/cebf77fb936a7270c7e3fa5c4a7e76216321d385/clang/lib/Sema/SemaDecl.cpp#L1529 and it makes sense after runing unit test on `check-clang` locally. Then I think you are right.

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


More information about the cfe-commits mailing list