Details
- Reviewers
• Quuxplusone ldionne Mordante cjdb - Group Reviewers
Restricted Project
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
LGTM, possibly add another bullet point saying that tiny elements don't get their own header (e.g. the contents of <type_traits> won't be split into loads of tiny headers with exactly one query or modifier and its shorthand).
libcxx/docs/Contributing.rst | ||
---|---|---|
72–74 | I think a bit more justification on why this is undesirable is necessary. |
Thanks for documenting this! In general I like it a lot, but I've some suggestions for improvments.
libcxx/docs/Contributing.rst | ||
---|---|---|
71 | Please add a bullet these headers should have a .h extension. | |
72–74 | +1 it would be nice it this bullet gives a bit more guidance. | |
78 | Maybe add the reason why it's required? For example Thid inclusion is mandatory since the standard requires the header to provide these declarations. | |
78 | Can you add a bullet that the synopsis should be in the parent header and not duplicated in the sub-header? |
libcxx/docs/Contributing.rst | ||
---|---|---|
70–71 | Stronger: The current naming convention is exactly __<toplevelheadername>/<featurename>.h. toplevelheadername must be the exact name of whatever header the Standard requires to contain this feature, e.g. string or ranges or memory. featurename should be the exact public identifier of the feature defined in this header, e.g. iterator_traits or construct_at. Exceptions exist (e.g. maybe __iterator/iterator_tags.h; __functional/ops.h) but I expect those exceptions are very rare. If we enforce the general rule "Name the header after what it defines," then we successfully prevent most attempts to introduce "__detail/utils.h" (because detail is not the name of a top-level header and utils is not a public identifier). | |
75–78 | Someone likes the word "imperative" lately. :) |
- Apply feedback
libcxx/docs/Contributing.rst | ||
---|---|---|
75–78 |
:) sometimes I like a word and it gets stuck in my mind so I use it frequently. |
libcxx/docs/Contributing.rst | ||
---|---|---|
75 | I don't see a reason to mandate that. I also don't see a reason to go more than one level deep, but I would just not mention that in the policy since it otherwise creates a rule without having a real reason to. I think we can create the rule later if we do have a concrete reason to prohibit multiple levels. | |
78 | I disagree with this rule as it mandates a too high granularity for headers. I think it's entirely reasonable to bundle several public names into the same header if they are related. An example of that is __memory/shared_ptr.h. It would be crazy to define std::make_shared in a separate header even though it's technically a different public name. The rule should be to try and group things that are logically related together in a way that makes sense, but I don't think we can have a 100% systematic rule here. We'll always have to use our judgement, and that's fine. | |
80–88 | Include-what-you-use is different from requiring that all sub-headers are included by their parent header. I think they should be separate points. |
libcxx/docs/Contributing.rst | ||
---|---|---|
75 |
The most likely concrete reason would be, "Someone tried to actually do it." I'd much rather have the rule, and make the prospective-rule-breaker ask to open a discussion about changing the rule; than not have the rule, and permit the prospective-rule-breaker to submit a full-fledged PR for something and then defend it like "well, there's no rule against what I'm doing here." The whole point of D101098 as I understand it is to give us a place to point to and say, yes, there is a rule against that, because people cannot be [trusted and/or assumed] to figure this stuff out by osmosis anymore. | |
78 | FWIW, I agree about shared_ptr+make_shared. I would still like something in writing discouraging the use of "utils" or "helpers" headers. |
I like the shape this patch takes. Before approving I like to see all review comments addressed.
libcxx/docs/Contributing.rst | ||
---|---|---|
69 | s/whatever/the/, sounds better IMO. |
libcxx/docs/Contributing.rst | ||
---|---|---|
75 | Let's word it as "We try to keep directories no more than one level deep to keep things simple." That way it's not worded as a hard rule but we still mention it, so you've got your "place to point at" if you want to push back on a review that has abusive usage of nested directories. | |
78 | I agree with that. We want to discourage utility headers that are just a mash-up of "useful things", and this doc should mention it. |
s/whatever/the/, sounds better IMO.