[clang] [llvm] [LLVM][Clang] Add and enable strict mode for `getTrailingObjects` (PR #144930)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 24 11:13:04 PDT 2025


erichkeane wrote:

> Sure: The first line of the description attempts to define it:
> 
> > Under strict mode, the templated getTrailingObjects can be called only when there is > 1 trailing types.
> 
> I essentially used this strict mode to find all templated calls to `getTrailingObjects<X>` that could be converted to the simplified non-templated form `getTrailingObjects` in the series of PRs I did over last month. Essentially, what this will do is that any future user of TrailingObjects with a single trailing type will be forced to use the non-templated `getTrailingObjects`.

Oh! I see... hmm...  So this is for cases where we don't know how many items in the `TrailingObjects there are... 

I think I might prefer instead of a `strict` template argument, a different name for `getTrailingObjects` here, like `getNonCheckedTrailingObjects` (though that has other implications... `getNonStrictTrailingObjects<...>` with a comment?  

https://github.com/llvm/llvm-project/pull/144930


More information about the cfe-commits mailing list