Author: Timm Bäder
Date: 2024-07-24T16:54:38+02:00
New Revision: 9f08ae8d2dd1ff9ec3b033d099282dee05528413

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

LOG: [clang][Interp][NFC] Fix getting the record decl from a pointer type

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/Compiler.cpp 
b/clang/lib/AST/Interp/Compiler.cpp
index 0455eec3f0145..58a0852aca755 100644
--- a/clang/lib/AST/Interp/Compiler.cpp
+++ b/clang/lib/AST/Interp/Compiler.cpp
@@ -5281,8 +5281,8 @@ template <class Emitter>
 unsigned Compiler<Emitter>::collectBaseOffset(const QualType BaseType,
                                               const QualType DerivedType) {
   const auto extractRecordDecl = [](QualType Ty) -> const CXXRecordDecl * {
-    if (const auto *PT = dyn_cast<PointerType>(Ty))
-      return PT->getPointeeType()->getAsCXXRecordDecl();
+    if (const auto *R = Ty->getPointeeCXXRecordDecl())
+      return R;
     return Ty->getAsCXXRecordDecl();
   };
   const CXXRecordDecl *BaseDecl = extractRecordDecl(BaseType);


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to