Author: Timm Bäder Date: 2022-10-22T10:32:05+02:00 New Revision: 8013ab4f98c2ed3bb11dcb83179664cb595c31bb
URL: https://github.com/llvm/llvm-project/commit/8013ab4f98c2ed3bb11dcb83179664cb595c31bb DIFF: https://github.com/llvm/llvm-project/commit/8013ab4f98c2ed3bb11dcb83179664cb595c31bb.diff LOG: [clang][Interp][NFC] Simplify creating parameter descriptors ... using value_or instead of the if-else statement. Added: Modified: clang/lib/AST/Interp/ByteCodeEmitter.cpp Removed: ################################################################################ diff --git a/clang/lib/AST/Interp/ByteCodeEmitter.cpp b/clang/lib/AST/Interp/ByteCodeEmitter.cpp index d653da31d162..13284703bba1 100644 --- a/clang/lib/AST/Interp/ByteCodeEmitter.cpp +++ b/clang/lib/AST/Interp/ByteCodeEmitter.cpp @@ -56,13 +56,7 @@ ByteCodeEmitter::compileFunc(const FunctionDecl *FuncDecl) { // 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}); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits