AaronBallman wrote: > Another possibility would be to add a new kind of type sugar for these cases > that has the same canonical type but knows that it should print as `size_t` / > `ptrdiff_t` etc. That'd allow you to produce an identical AST regardless of > whether the typedefs are included, which seems like it'd be better for > tooling than having the sugared type depend on which includes are present.
Yeah, this is more inline with what I was thinking. Given that both C and C++ now have `z`-based literals for `size_t`-based types, I think we want to treat `size_t` more like a builtin type than continue to leave it as a magic type. > When formatting the type, you'd need to decide whether you want to always use > `size_t` as the formatted name, or perform some additional check such as > performing a name lookup into the global scope or into namespace `std` to see > if the type is present and correct, but that's just a type printing policy > decision, not something that affects correctness. +1 https://github.com/llvm/llvm-project/pull/136542 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits