[llvm-branch-commits] [clang] b0c713d - Add null checks
Samira Bakon via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Sep 9 11:12:47 PDT 2025
Author: Samira Bakon
Date: 2025-09-09T14:12:39-04:00
New Revision: b0c713d5851dcb5dd5002ea15793947e17b4ae1f
URL: https://github.com/llvm/llvm-project/commit/b0c713d5851dcb5dd5002ea15793947e17b4ae1f
DIFF: https://github.com/llvm/llvm-project/commit/b0c713d5851dcb5dd5002ea15793947e17b4ae1f.diff
LOG: Add null checks
Added:
Modified:
clang/lib/Analysis/FlowSensitive/RecordOps.cpp
Removed:
################################################################################
diff --git a/clang/lib/Analysis/FlowSensitive/RecordOps.cpp b/clang/lib/Analysis/FlowSensitive/RecordOps.cpp
index 71b2aa9ff2ec4..ed827ac2c7c90 100644
--- a/clang/lib/Analysis/FlowSensitive/RecordOps.cpp
+++ b/clang/lib/Analysis/FlowSensitive/RecordOps.cpp
@@ -84,7 +84,8 @@ void copyRecord(RecordStorageLocation &Src, RecordStorageLocation &Dst,
for (const auto &[Name, DstFieldLoc] : Dst.synthetic_fields())
copySyntheticField(DstFieldLoc->getType(), Src.getSyntheticField(Name),
*DstFieldLoc, Env);
- } else if (DstDecl->isDerivedFrom(SrcDecl)) {
+ } else if (SrcDecl != nullptr && DstDecl != nullptr &&
+ DstDecl->isDerivedFrom(SrcDecl)) {
for (auto [Field, SrcFieldLoc] : Src.children())
copyField(*Field, SrcFieldLoc, Dst.getChild(*Field), Dst, Env);
for (const auto &[Name, SrcFieldLoc] : Src.synthetic_fields())
More information about the llvm-branch-commits
mailing list