Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 36.4k
[DO NOT LAND] src: run clang-format on LINT_CPP_FILES#21998
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| --- | ||
| Language: Cpp | ||
| # BasedOnStyle: Google | ||
| AccessModifierOffset: -1 | ||
| AlignAfterOpenBracket: Align | ||
| AlignConsecutiveAssignments: false | ||
| AlignConsecutiveDeclarations: false | ||
| AlignEscapedNewlines: Right | ||
| AlignOperands: true | ||
| AlignTrailingComments: true | ||
| AllowAllParametersOfDeclarationOnNextLine: true | ||
| AllowShortBlocksOnASingleLine: false | ||
| AllowShortCaseLabelsOnASingleLine: false | ||
| AllowShortFunctionsOnASingleLine: Inline | ||
| AllowShortIfStatementsOnASingleLine: true | ||
| AllowShortLoopsOnASingleLine: true | ||
| AlwaysBreakAfterDefinitionReturnType: None | ||
| AlwaysBreakAfterReturnType: None | ||
| AlwaysBreakBeforeMultilineStrings: false | ||
| AlwaysBreakTemplateDeclarations: true | ||
| BinPackArguments: false | ||
| BinPackParameters: false | ||
| BraceWrapping: | ||
| AfterClass: false | ||
| AfterControlStatement: false | ||
| AfterEnum: false | ||
| AfterFunction: false | ||
| AfterNamespace: false | ||
| AfterObjCDeclaration: false | ||
| AfterStruct: false | ||
| AfterUnion: false | ||
| AfterExternBlock: false | ||
| BeforeCatch: false | ||
| BeforeElse: false | ||
| IndentBraces: false | ||
| SplitEmptyFunction: true | ||
| SplitEmptyRecord: true | ||
| SplitEmptyNamespace: true | ||
| BreakBeforeBinaryOperators: None | ||
| BreakBeforeBraces: Attach | ||
| BreakBeforeInheritanceComma: false | ||
| BreakBeforeTernaryOperators: true | ||
| BreakConstructorInitializersBeforeComma: false | ||
| BreakConstructorInitializers: BeforeColon | ||
| BreakAfterJavaFieldAnnotations: false | ||
| BreakStringLiterals: true | ||
| ColumnLimit: 80 | ||
| CommentPragmas: '^ IWYU pragma:' | ||
| CompactNamespaces: false | ||
| ConstructorInitializerAllOnOneLineOrOnePerLine: true | ||
| ConstructorInitializerIndentWidth: 4 | ||
| ContinuationIndentWidth: 4 | ||
| Cpp11BracedListStyle: true | ||
| DerivePointerAlignment: false | ||
| DisableFormat: false | ||
| ExperimentalAutoDetectBinPacking: false | ||
| FixNamespaceComments: true | ||
| ForEachMacros: | ||
| - foreach | ||
| - Q_FOREACH | ||
| - BOOST_FOREACH | ||
| IncludeBlocks: Preserve | ||
| IncludeCategories: | ||
| - Regex: '^<ext/.*\.h>' | ||
| Priority: 2 | ||
| - Regex: '^<.*\.h>' | ||
| Priority: 1 | ||
| - Regex: '^<.*' | ||
| Priority: 2 | ||
| - Regex: '.*' | ||
| Priority: 3 | ||
| IncludeIsMainRegex: '([-_](test|unittest))?$' | ||
| IndentCaseLabels: true | ||
| IndentPPDirectives: None | ||
| IndentWidth: 2 | ||
| IndentWrappedFunctionNames: false | ||
| JavaScriptQuotes: Leave | ||
| JavaScriptWrapImports: true | ||
| KeepEmptyLinesAtTheStartOfBlocks: false | ||
| MacroBlockBegin: '' | ||
| MacroBlockEnd: '' | ||
| MaxEmptyLinesToKeep: 1 | ||
| NamespaceIndentation: None | ||
| ObjCBlockIndentWidth: 2 | ||
| ObjCSpaceAfterProperty: false | ||
| ObjCSpaceBeforeProtocolList: false | ||
| PenaltyBreakAssignment: 2 | ||
| PenaltyBreakBeforeFirstCallParameter: 1 | ||
| PenaltyBreakComment: 300 | ||
| PenaltyBreakFirstLessLess: 120 | ||
| PenaltyBreakString: 1000 | ||
| PenaltyExcessCharacter: 1000000 | ||
| PenaltyReturnTypeOnItsOwnLine: 200 | ||
| PointerAlignment: Left | ||
| ReflowComments: true | ||
| SortIncludes: true | ||
| SortUsingDeclarations: true | ||
| SpaceAfterCStyleCast: false | ||
| SpaceAfterTemplateKeyword: true | ||
| SpaceBeforeAssignmentOperators: true | ||
| SpaceBeforeParens: ControlStatements | ||
| SpaceInEmptyParentheses: false | ||
| SpacesBeforeTrailingComments: 2 | ||
| SpacesInAngles: false | ||
| SpacesInContainerLiterals: true | ||
| SpacesInCStyleCastParentheses: false | ||
| SpacesInParentheses: false | ||
| SpacesInSquareBrackets: false | ||
| Standard: Auto | ||
| TabWidth: 8 | ||
| UseTab: Never |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| #include <v8.h> | ||
| #include <node.h> | ||
| #include <v8.h> | ||
| static int c = 0; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -2,8 +2,8 @@ | ||
| #ifndef SRC_ALIASED_BUFFER_H_ | ||
| #define SRC_ALIASED_BUFFER_H_ | ||
| #include "v8.h" | ||
| #include "util-inl.h" | ||
| #include "v8.h" | ||
| namespace node { | ||
| @@ -25,10 +25,7 @@ template <class NativeT, class V8T> | ||
| class AliasedBuffer { | ||
| public: | ||
| AliasedBuffer(v8::Isolate* isolate, const size_t count) | ||
| : isolate_(isolate), | ||
| count_(count), | ||
| byte_offset_(0), | ||
| free_buffer_(true) { | ||
| : isolate_(isolate), count_(count), byte_offset_(0), free_buffer_(true) { | ||
| CHECK_GT(count, 0); | ||
| const v8::HandleScope handle_scope(isolate_); | ||
| @@ -38,8 +35,8 @@ class AliasedBuffer { | ||
| buffer_ = Calloc<NativeT>(count); | ||
| // allocate v8 ArrayBuffer | ||
| v8::Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New( | ||
| isolate_, buffer_, sizeInBytes); | ||
| v8::Local<v8::ArrayBuffer> ab = | ||
| v8::ArrayBuffer::New(isolate_, buffer_, sizeInBytes); | ||
| // allocate v8 TypedArray | ||
| v8::Local<V8T> js_array = V8T::New(ab, byte_offset_, count); | ||
| @@ -57,8 +54,7 @@ class AliasedBuffer { | ||
| AliasedBuffer(v8::Isolate* isolate, | ||
| const size_t byte_offset, | ||
| const size_t count, | ||
| const AliasedBuffer<uint8_t, | ||
| v8::Uint8Array>& backing_buffer) | ||
| const AliasedBuffer<uint8_t, v8::Uint8Array>& backing_buffer) | ||
| : isolate_(isolate), | ||
| count_(count), | ||
| byte_offset_(byte_offset), | ||
| @@ -70,7 +66,7 @@ class AliasedBuffer { | ||
| // validate that the byte_offset is aligned with sizeof(NativeT) | ||
| CHECK_EQ(byte_offset & (sizeof(NativeT) - 1), 0); | ||
| // validate this fits inside the backing buffer | ||
| CHECK_LE(sizeof(NativeT) * count, ab->ByteLength() - byte_offset); | ||
| CHECK_LE(sizeof(NativeT) * count, ab->ByteLength() - byte_offset); | ||
| buffer_ = reinterpret_cast<NativeT*>( | ||
| const_cast<uint8_t*>(backing_buffer.GetNativeBuffer() + byte_offset)); | ||
| @@ -117,14 +113,10 @@ class AliasedBuffer { | ||
| class Reference { | ||
| public: | ||
| Reference(AliasedBuffer<NativeT, V8T>* aliased_buffer, size_t index) | ||
| : aliased_buffer_(aliased_buffer), | ||
| index_(index) { | ||
| } | ||
| : aliased_buffer_(aliased_buffer), index_(index) {} | ||
| Reference(const Reference& that) | ||
| : aliased_buffer_(that.aliased_buffer_), | ||
| index_(that.index_) { | ||
| } | ||
| : aliased_buffer_(that.aliased_buffer_), index_(that.index_) {} | ||
| inline Reference& operator=(const NativeT& val) { | ||
| aliased_buffer_->SetValue(index_, val); | ||
| @@ -135,9 +127,7 @@ class AliasedBuffer { | ||
| return *this = static_cast<NativeT>(val); | ||
| } | ||
| operator NativeT() const { | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we have return always on a new line? | ||
| return aliased_buffer_->GetValue(index_); | ||
| } | ||
| operator NativeT() const { return aliased_buffer_->GetValue(index_); } | ||
| inline Reference& operator+=(const NativeT& val) { | ||
| const NativeT current = aliased_buffer_->GetValue(index_); | ||
| @@ -163,14 +153,12 @@ class AliasedBuffer { | ||
| /** | ||
| * Get the underlying v8 TypedArray overlayed on top of the native buffer | ||
| */ | ||
| v8::Local<V8T> GetJSArray() const { | ||
| return js_array_.Get(isolate_); | ||
| } | ||
| v8::Local<V8T> GetJSArray() const { return js_array_.Get(isolate_); } | ||
| /** | ||
| * Get the underlying v8::ArrayBuffer underlying the TypedArray and | ||
| * overlaying the native buffer | ||
| */ | ||
| * Get the underlying v8::ArrayBuffer underlying the TypedArray and | ||
| * overlaying the native buffer | ||
| */ | ||
| v8::Local<v8::ArrayBuffer> GetArrayBuffer() const { | ||
| return GetJSArray()->Buffer(); | ||
| } | ||
| @@ -179,16 +167,12 @@ class AliasedBuffer { | ||
| * Get the underlying native buffer. Note that all reads/writes should occur | ||
| * through the GetValue/SetValue/operator[] methods | ||
| */ | ||
| inline const NativeT* GetNativeBuffer() const { | ||
| return buffer_; | ||
| } | ||
| inline const NativeT* GetNativeBuffer() const { return buffer_; } | ||
| /** | ||
| * Synonym for GetBuffer() | ||
| */ | ||
| inline const NativeT* operator * () const { | ||
| return GetNativeBuffer(); | ||
| } | ||
| inline const NativeT* operator*() const { return GetNativeBuffer(); } | ||
| /** | ||
| * Set position index to given value. | ||
| @@ -213,17 +197,11 @@ class AliasedBuffer { | ||
| /** | ||
| * Effectively, a synonym for GetValue/SetValue | ||
| */ | ||
| Reference operator[](size_t index) { | ||
| return Reference(this, index); | ||
| } | ||
| Reference operator[](size_t index) { return Reference(this, index); } | ||
| NativeT operator[](size_t index) const { | ||
| return GetValue(index); | ||
| } | ||
| NativeT operator[](size_t index) const { return GetValue(index); } | ||
| size_t Length() const { | ||
| return count_; | ||
| } | ||
| size_t Length() const { return count_; } | ||
| private: | ||
| v8::Isolate* isolate_; | ||
Uh oh!
There was an error while loading. Please reload this page.
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.