-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DO NOT LAND] src: run clang-format on LINT_CPP_FILES #21998
Conversation
This patch adds a `make format-cpp` shortcut to the Makefile that runs clang-format on the C++ diffs, and a `make format-cpp-build` to install clang-format from npm. To format staged changes: ``` $ make format-cpp ``` To format HEAD~1...HEAD (latest commit): ``` $ CLANG_FORMAT_START=`git rev-parse HEAD~1` make format-cpp ``` To format diff between master and current branch head (master...HEAD): ``` $ CLANG_FORMAT_START=master make format-cpp ``` Most of the .clang-format file comes from running ``` $ clang-format --dump-config --style=Google ``` with clang-format built with llvm/trunk 328768 (npm version 1.2.3) The clang-format version is fixed because different version of clang-format may format the files differently.
a6b3e3a
to
8bf9df6
Compare
3babcbc
to
189cd50
Compare
@@ -25,10 +25,7 @@ template <class NativeT, class V8T> | |||
class AliasedBuffer { | |||
public: | |||
AliasedBuffer(v8::Isolate* isolate, const size_t count) | |||
: isolate_(isolate), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i feel like this was more readable before
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is ConstructorInitializerAllOnOneLineOrOnePerLine
. There is apparently no option to force one per line.
@@ -135,9 +127,7 @@ class AliasedBuffer { | |||
return *this = static_cast<NativeT>(val); | |||
} | |||
|
|||
operator NativeT() const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we have return always on a new line?
@@ -33,46 +32,39 @@ static inline size_t base64_decoded_size_fast(size_t size) { | |||
|
|||
template <typename TypeName> | |||
size_t base64_decoded_size(const TypeName* src, size_t size) { | |||
if (size == 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return on new line
Boolean::New(env->isolate(), readable), | ||
Boolean::New(env->isolate(), writable) | ||
}; | ||
Local<Value> argv[5] = {Integer::New(env->isolate(), status), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ouch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@devsnek Yeah I thought it looked strange but then this came from Google's style and in the documentation they argued this is more suited for C++11 (This is named Cpp11BracedListStyle
)
I think this PR has run its course. Closing... |
This is how the clang-format file in #21997 styles the
$LINT_CPP_FILES
. It's just a preview, so please ignore it if you are not curious about how the styles enforced in #21997 look like.Produced with
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes