Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/llvm/llvm-project.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clang-change-namespace')
-rw-r--r--clang-tools-extra/clang-change-namespace/ChangeNamespace.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/clang-tools-extra/clang-change-namespace/ChangeNamespace.cpp b/clang-tools-extra/clang-change-namespace/ChangeNamespace.cpp
index 59acc29e8ee9..26d31c669bcc 100644
--- a/clang-tools-extra/clang-change-namespace/ChangeNamespace.cpp
+++ b/clang-tools-extra/clang-change-namespace/ChangeNamespace.cpp
@@ -567,14 +567,12 @@ void ChangeNamespaceTool::run(
if (Loc.getTypeLocClass() == TypeLoc::Elaborated) {
NestedNameSpecifierLoc NestedNameSpecifier =
Loc.castAs<ElaboratedTypeLoc>().getQualifierLoc();
- // This happens for friend declaration of a base class with injected class
- // name.
- if (!NestedNameSpecifier.getNestedNameSpecifier())
- return;
- const Type *SpecifierType =
- NestedNameSpecifier.getNestedNameSpecifier()->getAsType();
- if (SpecifierType && SpecifierType->isRecordType())
- return;
+ // FIXME: avoid changing injected class names.
+ if (auto *NNS = NestedNameSpecifier.getNestedNameSpecifier()) {
+ const Type *SpecifierType = NNS->getAsType();
+ if (SpecifierType && SpecifierType->isRecordType())
+ return;
+ }
}
fixTypeLoc(Result, startLocationForType(Loc), endLocationForType(Loc), Loc);
} else if (const auto *VarRef =