[clang-tools-extra] [clangd] Add new highlighting modifier `CommandLineDefined`. (PR #175495)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 15 20:55:59 PST 2026
anonymouspc wrote:
> Can you elaborate on the motivation for this? What are some scenarios in which it's necessary or important for a user to distinguish between macros defined in source code and macros defined on the command-line?
- **header-defined** macros, such as
- `stdin`, `offsetof`
- `UINT8_MAX`
- `BOOST_FUSION_ADAPT_STRUCT`, `BOOST_PP_REPEAT`
- `__cpp_concepts`, `__cpp_lib_ranges`.
They are **always defined** in different build type.
Editor/IDEs can always render `#ifdef __cpp_concepts` gray when `-std=c++17`.
- **command-line-defined** macros, such as
- `DEBUG`, `NDEBUG`
- `PKG_STATIC`, `PKG_SHARED`,
They are often **defined in certain build type**.
Even if `NDEBUG` is not defined, Editor/IDEs should not render the code between `#ifndef NDEBUG` gray.
https://github.com/llvm/llvm-project/pull/175495
More information about the cfe-commits
mailing list