Skip to content

Commit

Permalink
Use deduction guides for llvm::ArrayRef
Browse files Browse the repository at this point in the history
  • Loading branch information
devajithvs authored and jenkins committed Dec 13, 2023
1 parent 879eed2 commit a085cce
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
31 changes: 17 additions & 14 deletions lib/Interpreter/LookupHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1149,8 +1149,9 @@ namespace cling {
S.AddMethodCandidate(MD, I.getPair(), MD->getParent(),
/*ObjectType=*/ClassType,
/*ObjectClassification=*/ObjExprClassification,
llvm::makeArrayRef<Expr*>(GivenArgs.data(), GivenArgs.size()),
Candidates);
llvm::ArrayRef<Expr*>(GivenArgs.data(),
GivenArgs.size()),
Candidates);
}
else {
const FunctionProtoType* Proto = dyn_cast<FunctionProtoType>(
Expand All @@ -1164,7 +1165,8 @@ namespace cling {
continue;
}
S.AddOverloadCandidate(FD, I.getPair(),
llvm::makeArrayRef<Expr*>(GivenArgs.data(), GivenArgs.size()),
llvm::ArrayRef<Expr*>(GivenArgs.data(),
GivenArgs.size()),
Candidates);
}
}
Expand All @@ -1175,19 +1177,20 @@ namespace cling {
!isa<CXXConstructorDecl>(FTD->getTemplatedDecl())) {
// Class method template, not static, not a constructor, so has
// an implicit object argument.
S.AddMethodTemplateCandidate(FTD, I.getPair(),
cast<CXXRecordDecl>(FTD->getDeclContext()),
const_cast<TemplateArgumentListInfo*>(FuncTemplateArgs),
/*ObjectType=*/ClassType,
/*ObjectClassification=*/ObjExprClassification,
llvm::makeArrayRef<Expr*>(GivenArgs.data(), GivenArgs.size()),
Candidates);
S.AddMethodTemplateCandidate(
FTD, I.getPair(), cast<CXXRecordDecl>(FTD->getDeclContext()),
const_cast<TemplateArgumentListInfo*>(FuncTemplateArgs),
/*ObjectType=*/ClassType,
/*ObjectClassification=*/ObjExprClassification,
llvm::ArrayRef<Expr*>(GivenArgs.data(), GivenArgs.size()),
Candidates);
}
else {
S.AddTemplateOverloadCandidate(FTD, I.getPair(),
const_cast<TemplateArgumentListInfo*>(FuncTemplateArgs),
llvm::makeArrayRef<Expr*>(GivenArgs.data(), GivenArgs.size()),
Candidates, /*SuppressUserConversions=*/false);
S.AddTemplateOverloadCandidate(
FTD, I.getPair(),
const_cast<TemplateArgumentListInfo*>(FuncTemplateArgs),
llvm::ArrayRef<Expr*>(GivenArgs.data(), GivenArgs.size()),
Candidates, /*SuppressUserConversions=*/false);
}
}
else {
Expand Down
3 changes: 1 addition & 2 deletions lib/Utils/AST.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ namespace utils {

Expr* result = nullptr;
if (CompoundStmt* CS = dyn_cast<CompoundStmt>(FD->getBody())) {
ArrayRef<Stmt*> Stmts
= llvm::makeArrayRef(CS->body_begin(), CS->size());
ArrayRef<Stmt*> Stmts(CS->body_begin(), CS->size());
int indexOfLastExpr = Stmts.size();
while(indexOfLastExpr--) {
if (!isa<NullStmt>(Stmts[indexOfLastExpr]))
Expand Down

0 comments on commit a085cce

Please sign in to comment.