[clang] 37eb0d4 - [NFC] Check the nullness of pointer before dereference it in the assertion
Chuanqi Xu via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 3 01:40:34 PDT 2024
Author: Chuanqi Xu
Date: 2024-04-03T16:39:02+08:00
New Revision: 37eb0d4948dad6d2399915fde6eb5800c3fe825b
URL: https://github.com/llvm/llvm-project/commit/37eb0d4948dad6d2399915fde6eb5800c3fe825b
DIFF: https://github.com/llvm/llvm-project/commit/37eb0d4948dad6d2399915fde6eb5800c3fe825b.diff
LOG: [NFC] Check the nullness of pointer before dereference it in the assertion
This was part of https://github.com/llvm/llvm-project/pull/85050.
It is suggested to split the unrelated change as much as possible. So
here is the patch.
Added:
Modified:
clang/lib/Serialization/GeneratePCH.cpp
Removed:
################################################################################
diff --git a/clang/lib/Serialization/GeneratePCH.cpp b/clang/lib/Serialization/GeneratePCH.cpp
index fa712264d54a97..2fece29f34487e 100644
--- a/clang/lib/Serialization/GeneratePCH.cpp
+++ b/clang/lib/Serialization/GeneratePCH.cpp
@@ -102,7 +102,7 @@ ReducedBMIGenerator::ReducedBMIGenerator(Preprocessor &PP,
Module *ReducedBMIGenerator::getEmittingModule(ASTContext &Ctx) {
Module *M = Ctx.getCurrentNamedModule();
- assert(M->isNamedModuleUnit() &&
+ assert(M && M->isNamedModuleUnit() &&
"ReducedBMIGenerator should only be used with C++20 Named modules.");
return M;
}
More information about the cfe-commits
mailing list