aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Tooling/RefactoringTest.cpp
diff options
context:
space:
mode:
authorYanzuo Liu <zwuis@outlook.com>2025-07-18 09:01:47 +0800
committerGitHub <noreply@github.com>2025-07-18 09:01:47 +0800
commit4a9eaad9e1283b872788832d5bce7e7945b97c78 (patch)
tree38e8732ae27a471c01fab0c24cb3bbac684a86ac /clang/unittests/Tooling/RefactoringTest.cpp
parent28417e6459bb5174b9502f440e3dbb86f7a0046e (diff)
downloadllvm-4a9eaad9e1283b872788832d5bce7e7945b97c78.zip
llvm-4a9eaad9e1283b872788832d5bce7e7945b97c78.tar.gz
llvm-4a9eaad9e1283b872788832d5bce7e7945b97c78.tar.bz2
[Clang][AST][NFC] Introduce `NamespaceBaseDecl` (#149123)
Add `NamespaceBaseDecl` as common base class of `NamespaceDecl` and `NamespaceAliasDecl`. This simplifies `NestedNameSpecifier` a bit. Co-authored-by: Matheus Izvekov <mizvekov@gmail.com>
Diffstat (limited to 'clang/unittests/Tooling/RefactoringTest.cpp')
-rw-r--r--clang/unittests/Tooling/RefactoringTest.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/unittests/Tooling/RefactoringTest.cpp b/clang/unittests/Tooling/RefactoringTest.cpp
index 254d95b..35d1143 100644
--- a/clang/unittests/Tooling/RefactoringTest.cpp
+++ b/clang/unittests/Tooling/RefactoringTest.cpp
@@ -748,7 +748,8 @@ class NestedNameSpecifierAVisitor : public TestVisitor {
public:
bool TraverseNestedNameSpecifierLoc(NestedNameSpecifierLoc NNSLoc) override {
if (NNSLoc.getNestedNameSpecifier()) {
- if (const NamespaceDecl* NS = NNSLoc.getNestedNameSpecifier()->getAsNamespace()) {
+ if (const auto *NS = dyn_cast_if_present<NamespaceDecl>(
+ NNSLoc.getNestedNameSpecifier()->getAsNamespace())) {
if (NS->getName() == "a") {
Replace = Replacement(*SM, &NNSLoc, "", Context->getLangOpts());
}