================ @@ -146,9 +148,24 @@ class ASTWalker : public RecursiveASTVisitor<ASTWalker> { // // If it's an enum constant, it must be due to prior decl. Report references // to it when qualifier isn't a type. - if (llvm::isa<EnumConstantDecl>(FD)) { - if (!DRE->getQualifier() || DRE->getQualifier()->getAsNamespace()) - report(DRE->getLocation(), FD); + auto QualifierIsNamepsaceOrNone = [&DRE]() { + const auto *Qual = DRE->getQualifier(); + if (!Qual) + return true; + switch (Qual->getKind()) { + case NestedNameSpecifier::Namespace: + case NestedNameSpecifier::NamespaceAlias: + case NestedNameSpecifier::Global: + return true; + case NestedNameSpecifier::TypeSpec: + case NestedNameSpecifier::TypeSpecWithTemplate: + case NestedNameSpecifier::Super: + case NestedNameSpecifier::Identifier: + return false; + } ---------------- kadircet wrote:
we already have `Wswitch` in LLVM so there should be warnings (unless we actually add a default clause). added llvm_unreachable to have some more useful error messages at runtime though. https://github.com/llvm/llvm-project/pull/106706 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits