[clang] f651f13 - [clang][Interp][NFC] Add precondition assertions

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 1 07:26:04 PST 2024


Author: Timm Bäder
Date: 2024-03-01T15:41:49+01:00
New Revision: f651f134bbaec069968f6b12bdcdb5f7752fd700

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

LOG: [clang][Interp][NFC] Add precondition assertions

All three of these need to be non-null.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/Context.cpp b/clang/lib/AST/Interp/Context.cpp
index 6121395f5fc4fd..017095352dc235 100644
--- a/clang/lib/AST/Interp/Context.cpp
+++ b/clang/lib/AST/Interp/Context.cpp
@@ -224,6 +224,9 @@ const CXXMethodDecl *
 Context::getOverridingFunction(const CXXRecordDecl *DynamicDecl,
                                const CXXRecordDecl *StaticDecl,
                                const CXXMethodDecl *InitialFunction) const {
+  assert(DynamicDecl);
+  assert(StaticDecl);
+  assert(InitialFunction);
 
   const CXXRecordDecl *CurRecord = DynamicDecl;
   const CXXMethodDecl *FoundFunction = InitialFunction;


        


More information about the cfe-commits mailing list