[clang] 6aaf9c8 - [clang][Interp][NFC] Sanitize collectBaseOffset parameters

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 19 02:07:39 PDT 2024


Author: Timm Bäder
Date: 2024-03-19T10:07:23+01:00
New Revision: 6aaf9c83099b80e73ef2208ae9f7f300c7808659

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

LOG: [clang][Interp][NFC] Sanitize collectBaseOffset parameters

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
index af214d4a8577c6..73831eefba4568 100644
--- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp
+++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
@@ -3337,6 +3337,8 @@ template <class Emitter>
 unsigned
 ByteCodeExprGen<Emitter>::collectBaseOffset(const RecordType *BaseType,
                                             const RecordType *DerivedType) {
+  assert(BaseType);
+  assert(DerivedType);
   const auto *FinalDecl = cast<CXXRecordDecl>(BaseType->getDecl());
   const RecordDecl *CurDecl = DerivedType->getDecl();
   const Record *CurRecord = getRecord(CurDecl);


        


More information about the cfe-commits mailing list