[PATCH] D67025: Add .inl as valid C++ header type

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 21 04:51:42 PDT 2022


aaron.ballman added a comment.

In D67025#3666513 <https://reviews.llvm.org/D67025#3666513>, @sammccall wrote:

>> ! In D67025#3665293 <https://reviews.llvm.org/D67025#3665293>, @aaron.ballman wrote:
>>  this is why we have the `-x` option so that users can specify a specific language mode to use. Is there a reason that option does not suffice for clangd?
>
> The difficulty here is that command-line flags are a very awkward/brittle interface but also the only one we have.

Thank you for the explanation (and thanks to @nridge as well). That is an awkward situation. :-(

In D67025#3666544 <https://reviews.llvm.org/D67025#3666544>, @tschuett wrote:

> Note that in this directory is an ,inl file:
> https://github.com/openucx/ucx/tree/master/src/uct/ib/mlx5
> It is a pure C library with C++ gtest.
>
> I believe that .inl is about inlining, but it is not tied to a language.

This captures my fear about trying to nail down this extension in the compiler. File extensions are the best we've got for identifying the purpose for a file, and .inl sounds a lot like it's used somewhat as a header file and somewhat as an implementation file, which means it's close in nature to a .inc or .def file. We've traditionally avoided trying to classify these because of the chances of getting the behavior wrong. That said, in all of these cases, the most common usage pattern is to include the file inside of another file rather than compile it directly, which does map fairly closely to header files.

I'm not certain what the best answer is.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67025



More information about the cfe-commits mailing list