[PATCH] D116203: [clang] adds unary type transformations as compiler built-ins

Christopher Di Bella via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 12 12:04:59 PDT 2022


cjdb marked an inline comment as done.
cjdb added inline comments.


================
Comment at: clang/include/clang/Sema/DeclSpec.h:424-431
+  static bool isTransformTypeTrait(TST T) {
+    constexpr TST Traits[] = {
+#define TRANSFORM_TYPE_TRAIT_DEF(_, Trait) TST_##Trait,
+#include "clang/AST/TransformTypeTraits.def"
+    };
+
+    return (T >= Traits[0] && T <= std::end(Traits)[-1]);
----------------
aaron.ballman wrote:
> Errr, this isn't Python, so that `[-1]` terrifies me. It took me a good solid ten minutes to convince myself this was actually valid. Any interest in something along the lines of this form?
I have many questions about the decisions I made in this snippet.


================
Comment at: clang/lib/AST/TypePrinter.cpp:1158
                                            raw_ostream &OS) {
   IncludeStrongLifetimeRAII Strong(Policy);
 }
----------------
aaron.ballman wrote:
> cjdb wrote:
> > rsmith wrote:
> > > Remove this line too. No point building an RAII scope with nothing in it.
> > Can we get rid of this function entirely in that case?
> I believe you can.
It looks like other things also have this as just empty, so maybe it's best to keep it?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116203



More information about the cfe-commits mailing list