[libclang] Fix crash when code-completing inside constructor initializer for a builtin type.

rdar://20149746

llvm-svn: 232145
This commit is contained in:
Argyrios Kyrtzidis
2015-03-13 07:39:30 +00:00
parent 41a185c521
commit ee1d76f361
2 changed files with 21 additions and 1 deletions

View File

@@ -4035,12 +4035,18 @@ void Sema::CodeCompleteConstructor(Scope *S, QualType Type, SourceLocation Loc,
if (RequireCompleteType(Loc, Type, 0))
return;
CXXRecordDecl *RD = Type->getAsCXXRecordDecl();
if (!RD) {
CodeCompleteExpression(S, Type);
return;
}
// FIXME: Provide support for member initializers.
// FIXME: Provide support for variadic template constructors.
OverloadCandidateSet CandidateSet(Loc, OverloadCandidateSet::CSK_Normal);
for (auto C : LookupConstructors(Type->getAsCXXRecordDecl())) {
for (auto C : LookupConstructors(RD)) {
if (auto FD = dyn_cast<FunctionDecl>(C)) {
AddOverloadCandidate(FD, DeclAccessPair::make(FD, C->getAccess()),
Args, CandidateSet,