[clang] caa83d2 - [clang][Interp][NFC] Simplify InterpFrame::describe

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 25 23:55:36 PDT 2022


Author: Timm Bäder
Date: 2022-10-26T08:49:44+02:00
New Revision: caa83d23295ae42334ea692a300e9acc77a30449

URL: https://github.com/llvm/llvm-project/commit/caa83d23295ae42334ea692a300e9acc77a30449
DIFF: https://github.com/llvm/llvm-project/commit/caa83d23295ae42334ea692a300e9acc77a30449.diff

LOG: [clang][Interp][NFC] Simplify InterpFrame::describe

Added: 
    

Modified: 
    clang/lib/AST/Interp/InterpFrame.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/InterpFrame.cpp b/clang/lib/AST/Interp/InterpFrame.cpp
index 1a97e2ad02b4..781b6d8a845a 100644
--- a/clang/lib/AST/Interp/InterpFrame.cpp
+++ b/clang/lib/AST/Interp/InterpFrame.cpp
@@ -157,12 +157,7 @@ void InterpFrame::describe(llvm::raw_ostream &OS) {
   for (unsigned I = 0, N = F->getNumParams(); I < N; ++I) {
     QualType Ty = F->getParamDecl(I)->getType();
 
-    PrimType PrimTy;
-    if (llvm::Optional<PrimType> T = S.Ctx.classify(Ty)) {
-      PrimTy = *T;
-    } else {
-      PrimTy = PT_Ptr;
-    }
+    PrimType PrimTy = S.Ctx.classify(Ty).value_or(PT_Ptr);
 
     TYPE_SWITCH(PrimTy, print(OS, stackRef<T>(Off), S.getCtx(), Ty));
     Off += align(primSize(PrimTy));


        


More information about the cfe-commits mailing list