[PATCH] D106732: Support macro deprecation #pragma clang deprecated

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 26 09:14:31 PDT 2021


aaron.ballman added inline comments.


================
Comment at: clang/docs/LanguageExtensions.rst:3875
+   #define MIN(x, y) x < y ? x : y
+   #pragma clang deprecated("MIN", "use std::min instead")
+
----------------
beanz wrote:
> aaron.ballman wrote:
> > Rather than use a string literal, did you consider using an unexpanded identifier token?
> The Lexer expands preprocessor macros, so you wouldn't get an identifier token, you actually get the tokens inside the macro. I suspect this is why `#pragma push_macro` does the same thing and uses a string literal.
You can lex in either mode. See `LexUnexpandedToken()`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106732/new/

https://reviews.llvm.org/D106732



More information about the cfe-commits mailing list