[clang] 72d300a - [clang][Interp][NFC] Move a varible declaration in the closest scope

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 14 05:51:15 PDT 2024


Author: Timm Bäder
Date: 2024-03-14T13:50:05+01:00
New Revision: 72d300adad4022b150c24e4a44488d3b9334e999

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

LOG: [clang][Interp][NFC] Move a varible declaration in the closest scope

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/Pointer.cpp b/clang/lib/AST/Interp/Pointer.cpp
index 3f85635f43674d..af60ced0e10e9e 100644
--- a/clang/lib/AST/Interp/Pointer.cpp
+++ b/clang/lib/AST/Interp/Pointer.cpp
@@ -320,10 +320,10 @@ std::optional<APValue> Pointer::toRValue(const Context &Ctx) const {
     // Complex types.
     if (const auto *CT = Ty->getAs<ComplexType>()) {
       QualType ElemTy = CT->getElementType();
-      std::optional<PrimType> ElemT = Ctx.classify(ElemTy);
-      assert(ElemT);
 
       if (ElemTy->isIntegerType()) {
+        std::optional<PrimType> ElemT = Ctx.classify(ElemTy);
+        assert(ElemT);
         INT_TYPE_SWITCH(*ElemT, {
           auto V1 = Ptr.atIndex(0).deref<T>();
           auto V2 = Ptr.atIndex(1).deref<T>();


        


More information about the cfe-commits mailing list