llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Yanzuo Liu (zwuis) <details> <summary>Changes</summary> 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 --- Full diff: https://github.com/llvm/llvm-project/pull/199824.diff 1 Files Affected: - (modified) clang/docs/InternalsManual.rst (+20) ``````````diff 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: `````````` </details> https://github.com/llvm/llvm-project/pull/199824 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
