Skip to content

Commit a7ee743

Browse files
Expose simplifyType() publically in HeuristicResolver
1 parent d49ea63 commit a7ee743

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

clang/include/clang/Sema/HeuristicResolver.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,14 @@ class HeuristicResolver {
8585
// in which a member's name can be looked up.
8686
TagDecl *resolveTypeToTagDecl(QualType T) const;
8787

88+
// Simplify the type `Type`.
89+
// `E` is the expression whose type `Type` is, if known. This sometimes
90+
// contains information relevant to the type that's not stored in `Type`
91+
// itself.
92+
// If `UnwrapPointer` is true, exactly only pointer type will be unwrapped
93+
// during simplification, and the operation fails if no pointer type is found.
94+
QualType simplifyType(QualType Type, const Expr *E, bool UnwrapPointer);
95+
8896
private:
8997
ASTContext &Ctx;
9098
};

clang/lib/Sema/HeuristicResolver.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class HeuristicResolverImpl {
4949
lookupDependentName(CXXRecordDecl *RD, DeclarationName Name,
5050
llvm::function_ref<bool(const NamedDecl *ND)> Filter);
5151
TagDecl *resolveTypeToTagDecl(QualType T);
52+
QualType simplifyType(QualType Type, const Expr *E, bool UnwrapPointer);
5253

5354
private:
5455
ASTContext &Ctx;
@@ -74,15 +75,6 @@ class HeuristicResolverImpl {
7475
QualType resolveExprToType(const Expr *E);
7576
std::vector<const NamedDecl *> resolveExprToDecls(const Expr *E);
7677

77-
// Helper function for simplifying a type.
78-
// `Type` is the type to simplify.
79-
// `E` is the expression whose type `Type` is, if known. This sometimes
80-
// contains information relevant to the type that's not stored in `Type`
81-
// itself.
82-
// If `UnwrapPointer` is true, exactly only pointer type will be unwrapped
83-
// during simplification, and the operation fails if no pointer type is found.
84-
QualType simplifyType(QualType Type, const Expr *E, bool UnwrapPointer);
85-
8678
bool findOrdinaryMemberInDependentClasses(const CXXBaseSpecifier *Specifier,
8779
CXXBasePath &Path,
8880
DeclarationName Name);
@@ -552,5 +544,9 @@ const QualType HeuristicResolver::getPointeeType(QualType T) const {
552544
TagDecl *HeuristicResolver::resolveTypeToTagDecl(QualType T) const {
553545
return HeuristicResolverImpl(Ctx).resolveTypeToTagDecl(T);
554546
}
547+
QualType HeuristicResolver::simplifyType(QualType Type, const Expr *E,
548+
bool UnwrapPointer) {
549+
return HeuristicResolverImpl(Ctx).simplifyType(Type, E, UnwrapPointer);
550+
}
555551

556552
} // namespace clang

0 commit comments

Comments
 (0)