[Sema] Fix an assertion failure in -Wcompletion-handler

NamedDecl::getName() was being called on a constructor.
This commit is contained in:
Erik Pilkington 2021-01-25 10:53:25 -05:00
parent 3fbd3eaf28
commit c4355670b4
2 changed files with 10 additions and 2 deletions

View File

@ -936,8 +936,9 @@ private:
/// Return true if the only parameter of the function is conventional.
static bool isOnlyParameterConventional(const FunctionDecl *Function) {
return Function->getNumParams() == 1 &&
hasConventionalSuffix(Function->getName());
IdentifierInfo *II = Function->getIdentifier();
return Function->getNumParams() == 1 && II &&
hasConventionalSuffix(II->getName());
}
/// Return true/false if 'swift_async' attribute states that the given

View File

@ -0,0 +1,7 @@
// RUN: %clang_cc1 -verify -fsyntax-only -Wcompletion-handler %s
// expected-no-diagnostics
class HasCtor {
HasCtor(void *) {}
};