// This avoids fixing types with record types as qualifier, which is not
// filtered by matchers in some cases, e.g. the type is templated. We should
// handle the record type qualifier instead.
- if (TLoc->getTypeLocClass() == TypeLoc::Elaborated) {
+ TypeLoc Loc = *TLoc;
+ while (Loc.getTypeLocClass() == TypeLoc::Qualified)
+ Loc = Loc.getNextTypeLoc();
+ if (Loc.getTypeLocClass() == TypeLoc::Elaborated) {
NestedNameSpecifierLoc NestedNameSpecifier =
- TLoc->castAs<ElaboratedTypeLoc>().getQualifierLoc();
+ Loc.castAs<ElaboratedTypeLoc>().getQualifierLoc();
const Type *SpecifierType =
NestedNameSpecifier.getNestedNameSpecifier()->getAsType();
if (SpecifierType && SpecifierType->isRecordType())
return;
}
- fixTypeLoc(Result, startLocationForType(*TLoc), endLocationForType(*TLoc),
- *TLoc);
+ fixTypeLoc(Result, startLocationForType(Loc), endLocationForType(Loc), Loc);
} else if (const auto *VarRef =
Result.Nodes.getNodeAs<DeclRefExpr>("var_ref")) {
const auto *Var = Result.Nodes.getNodeAs<VarDecl>("var_decl");
"public:\n"
" template<typename P>\n"
" using GG = some_ns::G<int, P>;\n"
+ "\n"
+ " struct Nested {};\n"
"};\n"
"class Derived : public Base {};\n"
"} // namespace na\n"
"namespace nb {\n"
"void f() {\n"
" Derived::GG<float> g;\n"
+ " const Derived::GG<int> gg;\n"
+ " const Derived::GG<int>* gg_ptr;\n"
+ " struct Derived::Nested nested;\n"
+ " const struct Derived::Nested *nested_ptr;\n"
"}\n"
"} // namespace nb\n"
"} // namespace na\n";
"public:\n"
" template<typename P>\n"
" using GG = some_ns::G<int, P>;\n"
+ "\n"
+ " struct Nested {};\n"
"};\n"
"class Derived : public Base {};\n"
"} // namespace na\n"
"namespace nc {\n"
"void f() {\n"
" Derived::GG<float> g;\n"
+ " const Derived::GG<int> gg;\n"
+ " const Derived::GG<int>* gg_ptr;\n"
+ " struct Derived::Nested nested;\n"
+ " const struct Derived::Nested *nested_ptr;\n"
"}\n"
"} // namespace nc\n\n"
"} // namespace nb\n"