Skip to content

Commit e920479

Browse files
Expose simplifyType() publically in HeuristicResolver
1 parent d5be29e commit e920479

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
@@ -48,6 +48,7 @@ class HeuristicResolverImpl {
4848
lookupDependentName(CXXRecordDecl *RD, DeclarationName Name,
4949
llvm::function_ref<bool(const NamedDecl *ND)> Filter);
5050
TagDecl *resolveTypeToTagDecl(QualType T);
51+
QualType simplifyType(QualType Type, const Expr *E, bool UnwrapPointer);
5152

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

76-
// Helper function for simplifying a type.
77-
// `Type` is the type to simplify.
78-
// `E` is the expression whose type `Type` is, if known. This sometimes
79-
// contains information relevant to the type that's not stored in `Type`
80-
// itself.
81-
// If `UnwrapPointer` is true, exactly only pointer type will be unwrapped
82-
// during simplification, and the operation fails if no pointer type is found.
83-
QualType simplifyType(QualType Type, const Expr *E, bool UnwrapPointer);
84-
8577
bool findOrdinaryMemberInDependentClasses(const CXXBaseSpecifier *Specifier,
8678
CXXBasePath &Path,
8779
DeclarationName Name);
@@ -537,5 +529,9 @@ const QualType HeuristicResolver::getPointeeType(QualType T) const {
537529
TagDecl *HeuristicResolver::resolveTypeToTagDecl(QualType T) const {
538530
return HeuristicResolverImpl(Ctx).resolveTypeToTagDecl(T);
539531
}
532+
QualType HeuristicResolver::simplifyType(QualType Type, const Expr *E,
533+
bool UnwrapPointer) {
534+
return HeuristicResolverImpl(Ctx).simplifyType(Type, E, UnwrapPointer);
535+
}
540536

541537
} // namespace clang

0 commit comments

Comments
 (0)