[clang] Fix NDEBUG Wundef warning; NFC (PR #170153)

via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 1 07:40:51 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Sven van Haastregt (svenvh)

<details>
<summary>Changes</summary>

The `NDEBUG` macro is tested for defined-ness everywhere else. The instance here triggers a warning when compiling with `-Wundef`.

---
Full diff: https://github.com/llvm/llvm-project/pull/170153.diff


1 Files Affected:

- (modified) clang/include/clang/Basic/TokenKinds.h (+1-1) 


``````````diff
diff --git a/clang/include/clang/Basic/TokenKinds.h b/clang/include/clang/Basic/TokenKinds.h
index d84f3598cbf33..a801113c57715 100644
--- a/clang/include/clang/Basic/TokenKinds.h
+++ b/clang/include/clang/Basic/TokenKinds.h
@@ -98,7 +98,7 @@ inline bool isLiteral(TokenKind K) {
   const bool isInLiteralRange =
       K >= tok::numeric_constant && K <= tok::utf32_string_literal;
 
-#if !NDEBUG
+#ifndef NDEBUG
   const bool isLiteralExplicit =
       K == tok::numeric_constant || K == tok::char_constant ||
       K == tok::wide_char_constant || K == tok::utf8_char_constant ||

``````````

</details>


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


More information about the cfe-commits mailing list