[clang compat] Back up through sugar before parent type check
This is kind-of the inverse of desugaring -- walk up the ancestor chain until we're at the most elaborated (should really be "sugared") ancestor. Then we can make assumptions about parent types again. Clang 15f3cd6bfc670ba6106184a903eb04be059e5977 made this necessary, because many more type nodes are now wrapped in ElaboratedType, which breaks naive parent type checking.
This commit is contained in:
parent
18a331be38
commit
ce63c68ed2
3
iwyu.cc
3
iwyu.cc
|
@ -1586,7 +1586,8 @@ class IwyuBaseAstVisitor : public BaseAstVisitor<Derived> {
|
|||
// typedef (that is, 'typedef MyTypedef OtherTypdef'), then the
|
||||
// user -- the other typedef -- is never responsible for the
|
||||
// underlying type. Instead, users of that typedef are.
|
||||
if (!current_ast_node()->template ParentIsA<TypedefNameDecl>()) {
|
||||
const ASTNode* ast_node = MostElaboratedAncestor(current_ast_node());
|
||||
if (!ast_node->ParentIsA<TypedefNameDecl>()) {
|
||||
const set<const Type*>& underlying_types
|
||||
= GetCallerResponsibleTypesForTypedef(typedef_decl);
|
||||
if (!underlying_types.empty()) {
|
||||
|
|
Loading…
Reference in New Issue