[llvm] [llvm] Validate Parent object before dereference (PR #157460)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 9 02:13:20 PDT 2025


================
@@ -472,10 +472,10 @@ Archive::Child::Child(const Archive *Parent, const char *Start, Error *Err)
     return;
   }
 
+  assert(Parent && "Parent can't be nullptr if Start is not a nullptr");
----------------
jh7370 wrote:

We don't tend to assert that something is not `nullptr`, if the subsequent check is about to dereference it anyway, so I'd delete this assertion.

https://github.com/llvm/llvm-project/pull/157460


More information about the llvm-commits mailing list