@@ -1461,12 +1461,6 @@ void AstVisitor::AddTypeReferencesFromLocation(LocationId location_id,
1461
1461
type = pointee_type;
1462
1462
}
1463
1463
1464
- // Then strip sugar (`struct` keyword, name qualifications, etc.)
1465
- while (llvm::isa<clang::ElaboratedType>(type)) {
1466
- const auto * elaborated_type = llvm::cast<clang::ElaboratedType>(type);
1467
- type = elaborated_type->desugar ().getTypePtrOrNull ();
1468
- }
1469
-
1470
1464
if (llvm::isa<clang::TemplateSpecializationType>(type)) {
1471
1465
auto * specialization_type =
1472
1466
llvm::cast<clang::TemplateSpecializationType>(type);
@@ -1635,7 +1629,10 @@ void AstVisitor::AddReferencesForExpr(const clang::Expr* expr) {
1635
1629
if (decl && llvm::isa<clang::CXXMethodDecl>(decl)) {
1636
1630
const auto * method_decl = llvm::cast<clang::CXXMethodDecl>(decl);
1637
1631
if (method_decl->getParent ()) {
1638
- const auto * type = method_decl->getParent ()->getTypeForDecl ();
1632
+ const auto * type = method_decl->getParent ()
1633
+ ->getASTContext ()
1634
+ .getCanonicalTagType (method_decl->getParent ())
1635
+ .getTypePtr ();
1639
1636
if (type) {
1640
1637
AddTypeReferencesForSourceRange (expr->getSourceRange (), type);
1641
1638
}
@@ -1648,7 +1645,11 @@ void AstVisitor::AddReferencesForExpr(const clang::Expr* expr) {
1648
1645
const auto * constructor_decl =
1649
1646
llvm::cast<clang::CXXConstructorDecl>(decl);
1650
1647
if (constructor_decl->getParent ()) {
1651
- const auto * type = constructor_decl->getParent ()->getTypeForDecl ();
1648
+ const auto * type =
1649
+ constructor_decl->getParent ()
1650
+ ->getASTContext ()
1651
+ .getCanonicalTagType (constructor_decl->getParent ())
1652
+ .getTypePtr ();
1652
1653
if (type) {
1653
1654
AddTypeReferencesForSourceRange (expr->getSourceRange (), type);
1654
1655
}
0 commit comments