This is an archive of the discontinued LLVM Phabricator instance.

[libc++][NFC] Reformat <__filesystem/operations.h>
ClosedPublic

Authored by philnik on Dec 23 2021, 12:18 PM.

Details

Summary

Reformat <__filesystem/operations.h>

Diff Detail

Event Timeline

philnik requested review of this revision.Dec 23 2021, 12:18 PM
philnik created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptDec 23 2021, 12:18 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
Quuxplusone requested changes to this revision.Dec 23 2021, 12:59 PM
Quuxplusone added inline comments.
libcxx/include/__filesystem/operations.h
32–33

FWIW, these 26 lines seem uncontroversial to me. Below this point, stuff gets messy.

60

s/_LIBCPP_INLINE_VISIBILITY/_LIBCPP_HIDE_FROM_ABI/ throughout this file — it'll save you some column width. Perhaps do that as a separate NFC commit (even though the whole thing is NFC anyway).

168–169

For all of these inline one-liners, I'd strongly prefer that they be formatted consistently. I don't have a strong preference for

inline _LIBCPP_HIDE_FROM_ABI function header() { return oneliner; }

versus

inline _LIBCPP_HIDE_FROM_ABI
function header() { return oneliner; }

versus

inline _LIBCPP_HIDE_FROM_ABI function header()
  { return oneliner; }

versus

inline _LIBCPP_HIDE_FROM_ABI function header() {
  return oneliner;
}

versus

inline _LIBCPP_HIDE_FROM_ABI
function header() {
  return oneliner;
}

but let's be consistent. Also, if we choose anything other than the first option (all-on-one-source-line), then let's add one blank line after each function, so they don't all run together visually.

This revision now requires changes to proceed.Dec 23 2021, 12:59 PM
philnik added inline comments.Dec 23 2021, 1:20 PM
libcxx/include/__filesystem/operations.h
168–169

Do you mean by the first one "ignore any line length limitation and put them in a single line"?

libcxx/include/__filesystem/operations.h
168–169

Do you mean by the first one "ignore any line length limitation and put them in a single line"?

Yes. (And likewise for the other possibilities, I mean "ignore any line length capabilities and put them all like this." My goal is to avoid the current state where my eyes are constantly having to scan back and forth to figure out "how is this function formatted?" — instead these functions should all just use the same formatting style, consistently.)

philnik updated this revision to Diff 396105.Dec 23 2021, 2:49 PM

I would replace _LIBCPP_INLINE_VISIBILITY with _LIBCPP_HIDE_FROM_ABI and move the two __ functions in a following commit
Put one-liners in a single line

ldionne accepted this revision.Jan 3 2022, 7:09 AM
ldionne added a subscriber: ldionne.

FWIW, I have no strong preference here. I think the code was readable before and is readable after. I think this is a follow up on a suggestion I made in an earlier modularization patch where I suggested aligning stuff would highlight that they are all forwarding to functions inside the dylib. That's the main benefit I see with this patch.

LGTM, but please rename to _LIBCPP_HIDE_FROM_ABI in another patch (or this one, IDC).

Quuxplusone accepted this revision.Jan 6 2022, 6:32 AM
This revision is now accepted and ready to land.Jan 6 2022, 6:32 AM
This revision was landed with ongoing or failed builds.Jan 6 2022, 7:17 AM
This revision was automatically updated to reflect the committed changes.