https://github.com/zwuis created 
https://github.com/llvm/llvm-project/pull/199824

Accidental behavior changes can go unnoticed when tests are commented out or 
disabled with `#if 0`.

This guidance assumes assertions builds, since some failing test cases only 
trigger assertion failures.

AI was used to rephase the PR title and the PR description.

Assisted-by: DeepSeek-V4-Pro

>From 275f0c2ef8cc5c8fca7321ebc14baf2c11318229 Mon Sep 17 00:00:00 2001
From: Yanzuo Liu <[email protected]>
Date: Wed, 27 May 2026 11:43:53 +0800
Subject: [PATCH] Document avoiding disabled tests

---
 clang/docs/InternalsManual.rst | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/clang/docs/InternalsManual.rst b/clang/docs/InternalsManual.rst
index 2dab979dac3e4..57633dc1627f7 100644
--- a/clang/docs/InternalsManual.rst
+++ b/clang/docs/InternalsManual.rst
@@ -3494,6 +3494,26 @@ diagnostic verifier will pass. However, if the expected 
error does not appear
 or appears in a different location than expected, or if additional diagnostics
 appear, the diagnostic verifier will fail and emit information as to why.
 
+To avoid accidentally missing behavior changes, never comment out code or use 
``#if 0`` to disable tests.
+If a test case causes a crash currently, use the ``-D`` option and the 
``#ifdef`` preprocessing directive to enable tests, and ``not --crash`` to 
verify the crash.
+
+.. code-block:: c++
+
+  // RUN: %clang_cc1 -verify %s
+  // RUN: not --crash %clang_cc1 -DCRASH1 -verify %s
+  // RUN: not --crash %clang_cc1 -DCRASH2 -verify %s
+
+  // test cases that do not cause a crash
+
+  #ifdef CRASH1
+  // a test case that causes a crash
+  #endif
+
+  #ifdef CRASH2
+  // another test case that causes a crash
+  #endif
+
+
 Directive Syntax
 ~~~~~~~~~~~~~~~~
 Syntax description of the directives is the following:

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to