... using value_or instead of the if-else statement.
// Assign descriptors to all parameters.
// Composite objects are lowered to pointers.
for (const ParmVarDecl *PD : FuncDecl->parameters()) {
- PrimType Ty;
- if (llvm::Optional<PrimType> T = Ctx.classify(PD->getType())) {
- Ty = *T;
- } else {
- Ty = PT_Ptr;
- }
-
+ PrimType Ty = Ctx.classify(PD->getType()).value_or(PT_Ptr);
Descriptor *Desc = P.createDescriptor(PD, Ty);
ParamDescriptors.insert({ParamOffset, {Ty, Desc}});
Params.insert({PD, ParamOffset});