Skip to content

Commit c0a939b

Browse files
committed
Simplify the check for whether the allocation function has been declared
1 parent 76826b0 commit c0a939b

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

clang/lib/Sema/SemaExprCXX.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3452,12 +3452,10 @@ void Sema::DeclareGlobalAllocationFunction(DeclarationName Name,
34523452
// non-templated allocation function we are trying to declare here.
34533453
if (FunctionDecl *Func = dyn_cast<FunctionDecl>(*Alloc)) {
34543454
if (Func->getNumParams() == Params.size()) {
3455-
llvm::SmallVector<QualType, 3> FuncParams;
3456-
for (auto *P : Func->parameters())
3457-
FuncParams.push_back(P->getType().getUnqualifiedType());
3458-
if (std::equal(FuncParams.begin(), FuncParams.end(), Params.begin(),
3459-
Params.end(), [&](QualType LT, QualType RT) {
3460-
return Context.hasSameType(LT, RT);
3455+
if (std::equal(Func->param_begin(), Func->param_end(), Params.begin(),
3456+
Params.end(), [&](ParmVarDecl *D, QualType RT) {
3457+
return Context.hasSameUnqualifiedType(D->getType(),
3458+
RT);
34613459
})) {
34623460
// Make the function visible to name lookup, even if we found it in
34633461
// an unimported module. It either is an implicitly-declared global

0 commit comments

Comments
 (0)