[PATCH] D151741: [Lex] Only warn on defining or undefining language-defined builtins

John Brawn via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 31 07:25:38 PDT 2023


john.brawn marked an inline comment as done.
john.brawn added inline comments.


================
Comment at: clang/lib/Lex/PPDirectives.cpp:163-172
+  // C defines macros starting with __STDC, and C++ defines macros starting with
+  // __STDCPP
+  if (MacroName.startswith("__STDC"))
+    return true;
+  // C++ defines the __cplusplus macro
+  if (MacroName == "__cplusplus")
+    return true;
----------------
nickdesaulniers wrote:
> Should these depend on LangOpt?
I don't think so. If we're e.g. not compiling C++ then __cplusplus won't be defined so it doesn't matter if we check for it.


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

https://reviews.llvm.org/D151741



More information about the cfe-commits mailing list