[PATCH] D136036: [Clang] Add __has_constexpr_builtin support

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 17 06:07:04 PDT 2022


aaron.ballman added a comment.

Can you also add documentation and a release note for the new feature testing macro?



================
Comment at: clang/lib/Lex/PPMacroExpansion.cpp:370
   // Clang Extensions.
-  Ident__FILE_NAME__      = RegisterBuiltinMacro(*this, "__FILE_NAME__");
-  Ident__has_feature      = RegisterBuiltinMacro(*this, "__has_feature");
-  Ident__has_extension    = RegisterBuiltinMacro(*this, "__has_extension");
-  Ident__has_builtin      = RegisterBuiltinMacro(*this, "__has_builtin");
-  Ident__has_attribute    = RegisterBuiltinMacro(*this, "__has_attribute");
+  Ident__FILE_NAME__ = RegisterBuiltinMacro(*this, "__FILE_NAME__");
+  Ident__has_feature = RegisterBuiltinMacro(*this, "__has_feature");
----------------
It looks like unrelated formatting changes snuck in to this file.


================
Comment at: clang/test/Preprocessor/feature_tests.cpp:56
+
+#if  __has_constexpr_builtin(__builtin_insanity)
+#error This is not a builtin in Clang
----------------
I'd appreciate some parsing tests:
```
#if __has_constexpr_builtin
#endif

#if __has_constexpr_builtin("__builtin_fmax")
#endif

#if __has_constexpr_builtin(__builtin_fmax, __builtin_fmin)
#endif
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136036



More information about the cfe-commits mailing list