This is an archive of the discontinued LLVM Phabricator instance.

[libc++][NFC] Fix include guard for decay_copy.h and remove underscores from the header
ClosedPublic

Authored by ldionne on Aug 27 2021, 7:39 AM.

Details

Summary

We don't use double underscores for private header names when they are
in a subdirectory with double underscores already.

Diff Detail

Event Timeline

ldionne created this revision.Aug 27 2021, 7:39 AM
ldionne requested review of this revision.Aug 27 2021, 7:39 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 27 2021, 7:39 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
Quuxplusone accepted this revision.Aug 27 2021, 8:40 AM

I'm happy assuming buildkite is happy!
FWIW, I do see two adjacent open questions, neither of which needs to be addressed in this PR:

  • Should <utility> include <__utility/decay_copy.h>? (I have no preference, except for consistency, and even gaining consistency seems like it'll be a bit of an uphill effort)
  • Should decay_copy.h really have that // -*- C++ -*- on line 1? @Mordante has pointed out that the comment is useful (to certain syntax-highlighting editors) for files with no extension, such as <string>, but for .h and .cpp files I assume it has little benefit. Right now some __foo/*.h subdirectories are totally comment-less (__compare, __concepts, __random), some are totally comment-ful (__format, __iterator, __memory, __ranges), and some are mixed (__functional, __utility). Personally I prefer comment-less.
This revision is now accepted and ready to land.Aug 27 2021, 8:40 AM

I'm happy assuming buildkite is happy!
FWIW, I do see two adjacent open questions, neither of which needs to be addressed in this PR:

  • Should <utility> include <__utility/decay_copy.h>? (I have no preference, except for consistency, and even gaining consistency seems like it'll be a bit of an uphill effort)

I guess it should, since we statued that <header> should include everything in <__header/*>. We can do that as a separate PR where we fix it for all subdirectories (you're welcome to do that!).

  • Should decay_copy.h really have that // -*- C++ -*- on line 1? @Mordante has pointed out that the comment is useful (to certain syntax-highlighting editors) for files with no extension, such as <string>, but for .h and .cpp files I assume it has little benefit. Right now some __foo/*.h subdirectories are totally comment-less (__compare, __concepts, __random), some are totally comment-ful (__format, __iterator, __memory, __ranges), and some are mixed (__functional, __utility). Personally I prefer comment-less.

I dislike those comments too, however they have started proving useful for the extension-less since I'm using VS Code (for some reason, it doesn't guess the language otherwise). I think we should be consistent and use it everywhere.