inclyc added inline comments.

================
Comment at: clang/lib/Basic/TypeTraits.cpp:64
+#define TYPE_TRAIT_N(Spelling, Name, Key) 0,
+#include "clang/Basic/TokenKinds.def"
+};
----------------
inclyc wrote:
> shafik wrote:
> > @aaron.ballman do we really have to include this three times? We are 
> > defining different macros so shouldn't we be able to include is just once? 
> > 
> > I see we do this in several other places but a few we don't.
> I've tried 
> 
> ```
> #define TYPE_TRAIT(N, I, K) N,
> #include "clang/Basic/TokenKinds.def"
> ```
> 
> But using enum `TypeTrait` as array index seems to have incorrect mapping.
> @aaron.ballman do we really have to include this three times? We are defining 
> different macros so shouldn't we be able to include is just once? 
> 
> I see we do this in several other places but a few we don't.

Type trait definitions in `#include "clang/Basic/TokenKinds.def"` may not be 
sorted by the number of arguments.

Example:

```
#define TYPE_TRAIT_1(some_stuff)
#define TYPE_TRAIT_N(some_stuff)
#define TYPE_TRAIT_2(some_stuff)
```

Might be necessary to include this 3 times to get sorted layouts, like

`[1, 1, 1, 2, 2, 2, 0, 0]`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131423

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to