Skip to content

Commit 8ab7cb8

Browse files
HighCommander4github-actions[bot]
authored andcommitted
Automerge: [clang][Sema] Null-check type in resolveMemberExpr() before checking for auto type (#124628)
Fixes clangd/clangd#2301
2 parents 6d82158 + 194c74e commit 8ab7cb8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

clang/lib/Sema/HeuristicResolver.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,15 +231,17 @@ std::vector<const NamedDecl *> HeuristicResolverImpl::resolveMemberExpr(
231231
QualType BaseType = ME->getBaseType();
232232
if (ME->isArrow()) {
233233
BaseType = getPointeeType(BaseType);
234+
if (BaseType.isNull())
235+
return {};
234236
}
235-
if (BaseType.isNull())
236-
return {};
237237
if (const auto *BT = BaseType->getAs<BuiltinType>()) {
238238
// If BaseType is the type of a dependent expression, it's just
239239
// represented as BuiltinType::Dependent which gives us no information. We
240240
// can get further by analyzing the dependent expression.
241241
if (Base && BT->getKind() == BuiltinType::Dependent) {
242242
BaseType = resolveExprToType(Base);
243+
if (BaseType.isNull())
244+
return {};
243245
}
244246
}
245247
if (const auto *AT = BaseType->getContainedAutoType()) {

0 commit comments

Comments
 (0)