static bool CheckElementalArguments(CodeGenModule &CGM, const FunctionDecl *FD, llvm::Function *Fn, bool &HasThis) { // Check the return type. QualType RetTy = FD->getReturnType(); if (RetTy->isAggregateType()) { CGM.Error(FD->getLocation(), "the return type for this elemental " "function is not supported yet"); return false; } // Check each parameter type. for (unsigned I = 0, E = FD->param_size(); I < E; ++I) { const ParmVarDecl *VD = FD->getParamDecl(I); QualType Ty = VD->getType(); assert(!Ty->isIncompleteType() && "incomplete type"); if (Ty->isAggregateType()) { CGM.Error(VD->getLocation(), "the parameter type for this elemental " "function is not supported yet"); return false; } } HasThis = isa<CXXMethodDecl>(FD) && cast<CXXMethodDecl>(FD)->isInstance(); // At this point, no passing struct arguments by value. unsigned NumArgs = FD->param_size(); unsigned NumLLVMArgs = Fn->arg_size(); // There is a single implicit 'this' parameter. if (HasThis && (NumArgs + 1 == NumLLVMArgs)) return true; return NumArgs == NumLLVMArgs; }