Remove PDFIUM_IMMEDIATE_CRASH().

Use CHECK() instead.

Change-Id: I6b6ade0195c838bc467a2b69fc3c8781cd674db0
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/52250
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxcrt/fx_system.h b/core/fxcrt/fx_system.h
index 8ad23a1..b6faa99 100644
--- a/core/fxcrt/fx_system.h
+++ b/core/fxcrt/fx_system.h
@@ -102,12 +102,6 @@
 #endif  // NDEBUG
 #endif  // ASSERT
 
-#if defined(__clang__) || defined(__GNUC__)
-#define PDFIUM_IMMEDIATE_CRASH() __builtin_trap()
-#else
-#define PDFIUM_IMMEDIATE_CRASH() ((void)(*(volatile char*)0 = 0))
-#endif  // defined(__clang__) || defined(__GNUC__)
-
 // M_PI not universally present on all platforms.
 #define FX_PI 3.1415926535897932384626433832795f
 #define FX_BEZIER 0.5522847498308f
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 4fb4cd3..ac8b5ad 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -1379,9 +1379,8 @@
 }
 
 void CXFA_Node::InsertChild(int32_t index, CXFA_Node* pNode) {
-  if (!pNode || pNode->parent_ != nullptr) {
-    PDFIUM_IMMEDIATE_CRASH();
-  }
+  CHECK(pNode);
+  CHECK(!pNode->parent_);
 
   pNode->parent_ = this;
   pNode->ClearFlag(XFA_NodeFlag_HasRemovedChildren);
@@ -1435,9 +1434,7 @@
 }
 
 void CXFA_Node::InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode) {
-  if (pBeforeNode && pBeforeNode->parent_ != this) {
-    PDFIUM_IMMEDIATE_CRASH();
-  }
+  CHECK(!pBeforeNode || pBeforeNode->parent_ == this);
 
   int32_t index = -1;
   if (!first_child_ || pBeforeNode == first_child_) {
@@ -1456,9 +1453,8 @@
 }
 
 void CXFA_Node::RemoveChild(CXFA_Node* pNode, bool bNotify) {
-  if (!pNode || pNode->parent_ != this) {
-    PDFIUM_IMMEDIATE_CRASH();
-  }
+  CHECK(pNode);
+  CHECK_EQ(pNode->parent_, this);
 
   pNode->SetFlag(XFA_NodeFlag_HasRemovedChildren);
 
@@ -2772,7 +2768,7 @@
 void CXFA_Node::CreateValueNodeIfNeeded(CXFA_Value* value,
                                         CXFA_Node* pUIChild) {
   // Value nodes only have one child. If we have one already we're done.
-  if (value->GetFirstChild() != nullptr)
+  if (value->GetFirstChild())
     return;
 
   // Create the Value node for our UI if needed.