Support macro deprecation #pragma clang deprecated
authorChris Bieneman <chris.bieneman@me.com>
Sat, 24 Jul 2021 00:43:45 +0000 (19:43 -0500)
committerChris Bieneman <chris.bieneman@me.com>
Thu, 29 Jul 2021 17:40:53 +0000 (12:40 -0500)
commit26c695b7893071d5e69afbaa70c4850ab2e468be
tree0951e09c225d37ba11013e9e9d222ccf6c90d202
parentee7c9b8f140d0614c3380022b27d9bbd963b9a77
Support macro deprecation #pragma clang deprecated

This patch adds `#pragma clang deprecated` to enable deprecation of
preprocessor macros.

The macro must be defined before `#pragma clang deprecated`. When
deprecating a macro a custom message may be optionally provided.

Warnings are emitted at the use site of a deprecated macro, and can be
controlled via the `-Wdeprecated` warning group.

This patch takes some rough inspiration and a few lines of code from
https://reviews.llvm.org/D67935.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D106732
clang/docs/LanguageExtensions.rst
clang/include/clang/Basic/DiagnosticGroups.td
clang/include/clang/Basic/DiagnosticLexKinds.td
clang/include/clang/Basic/IdentifierTable.h
clang/include/clang/Lex/Preprocessor.h
clang/lib/Lex/PPDirectives.cpp
clang/lib/Lex/PPExpressions.cpp
clang/lib/Lex/PPMacroExpansion.cpp
clang/lib/Lex/Pragma.cpp
clang/lib/Lex/Preprocessor.cpp
clang/test/Lexer/deprecate-macro.c [new file with mode: 0644]