llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-tools-extra

Author: kadir çetinkaya (kadircet)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/106706.diff


2 Files Affected:

- (modified) clang-tools-extra/include-cleaner/lib/WalkAST.cpp (+2-1) 
- (modified) clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp (+2) 


``````````diff
diff --git a/clang-tools-extra/include-cleaner/lib/WalkAST.cpp 
b/clang-tools-extra/include-cleaner/lib/WalkAST.cpp
index f7a2ebd5260681..9663c9916740eb 100644
--- a/clang-tools-extra/include-cleaner/lib/WalkAST.cpp
+++ b/clang-tools-extra/include-cleaner/lib/WalkAST.cpp
@@ -147,7 +147,8 @@ 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())
+      if (!DRE->getQualifier() || DRE->getQualifier()->getAsNamespace() ||
+          DRE->getQualifier()->getAsNamespaceAlias())
         report(DRE->getLocation(), FD);
     }
     return true;
diff --git a/clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp 
b/clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp
index 9286758cab081c..9ae9f9a5ddb829 100644
--- a/clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp
+++ b/clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp
@@ -534,6 +534,8 @@ TEST(WalkAST, Enums) {
   testWalk(R"(namespace ns { enum E { A = 42 }; }
               struct S { using ns::E::A; };)",
            "int e = S::^A;");
+  testWalk(R"(namespace ns { enum E { $explicit^A = 42 }; })",
+           "namespace z = ns; int e = z::^A;");
 }
 
 TEST(WalkAST, InitializerList) {

``````````

</details>


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

Reply via email to