Skip to content

Commit

Permalink
run clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
trxcllnt committed Aug 10, 2023
1 parent 299fc17 commit cc16694
Show file tree
Hide file tree
Showing 58 changed files with 478 additions and 412 deletions.
56 changes: 41 additions & 15 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
Language: Cpp
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignArrayOfStructures: None
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AlignOperands: AlignAfterOperator
AlignTrailingComments:
Kind: Always
OverEmptyLines: 2
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
Expand All @@ -22,6 +25,7 @@ AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackParameters: false
BitFieldColonSpacing: After
BraceWrapping:
AfterClass: false
AfterControlStatement: false
Expand All @@ -39,6 +43,8 @@ BraceWrapping:
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
BreakArrays: false
BreakAfterAttributes: Leave
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
Expand All @@ -56,7 +62,7 @@ ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 2
ContinuationIndentWidth: 2
Cpp11BracedListStyle: true
DerivePointerAlignment: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
Expand All @@ -79,7 +85,7 @@ IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 2
IndentWrappedFunctionNames: false
JavaScriptWrapImports: true
InsertNewlineAtEOF: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
Expand All @@ -98,6 +104,7 @@ PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
ReferenceAlignment: Left
RawStringFormats:
- Language: Cpp
Delimiters:
Expand Down Expand Up @@ -127,24 +134,30 @@ RawStringFormats:
BasedOnStyle: google
# Enabling comment reflow causes doxygen comments to be messed up in their formats!
ReflowComments: true
RemoveBracesLLVM: false
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInAngles: Never
SpacesInParens: Never
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
Standard: c++17
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
Expand All @@ -161,22 +174,21 @@ Language: JavaScript
#
#########################################################
AccessModifierOffset: 0
AlignArrayOfStructures: None
AllowAllArgumentsOnNextLine: true
AlignConsecutiveBitFields: true
AllowShortEnumsOnASingleLine: false
AllowShortLambdasOnASingleLine: All
BitFieldColonSpacing: After
BreakStringLiterals: false
InsertTrailingCommas: None
IndentCaseBlocks: false
JavaScriptQuotes: Single
PointerAlignment: Middle
JavaScriptWrapImports: true
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAroundPointerQualifiers: Both
SpaceBeforeCpp11BracedList: true
SpaceBeforeSquareBrackets: false
SpaceBeforeCtorInitializerColon: false
SpaceBeforeJsonColon: false
SpaceBeforeInheritanceColon: false
SpaceBeforeRangeBasedForLoopColon: false
SpacesInConditionalStatement: false
Expand All @@ -190,8 +202,10 @@ AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AlignOperands: AlignAfterOperator
AlignTrailingComments:
Kind: Always
OverEmptyLines: 2
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
Expand All @@ -205,6 +219,7 @@ AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackParameters: false
BitFieldColonSpacing: After
BraceWrapping:
AfterClass: false
AfterControlStatement: false
Expand All @@ -222,6 +237,8 @@ BraceWrapping:
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
BreakArrays: false
BreakAfterAttributes: Leave
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
Expand All @@ -238,7 +255,7 @@ ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 2
ContinuationIndentWidth: 2
Cpp11BracedListStyle: true
DerivePointerAlignment: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
Expand All @@ -261,6 +278,7 @@ IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 2
IndentWrappedFunctionNames: false
InsertNewlineAtEOF: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
Expand All @@ -278,6 +296,8 @@ PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
ReferenceAlignment: Left
RawStringFormats:
- Language: JavaScript
Delimiters:
Expand Down Expand Up @@ -312,18 +332,24 @@ RawStringFormats:
BasedOnStyle: google
# Enabling comment reflow causes doxygen comments to be messed up in their formats!
ReflowComments: true
RemoveBracesLLVM: false
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterTemplateKeyword: true
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeParens: ControlStatements
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInAngles: Never
SpacesInParens: Never
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
Standard: c++17
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
Expand Down
2 changes: 1 addition & 1 deletion modules/core/include/nv_node/utilities/args.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ struct CallbackArgs {
NapiToCPP const operator[](size_t i) const { return info_->operator[](i); }

inline Napi::CallbackInfo const& info() const { return *info_; }
inline operator Napi::CallbackInfo const &() const { return *info_; }
inline operator Napi::CallbackInfo const&() const { return *info_; }

private:
bool owns_info_{false};
Expand Down
6 changes: 3 additions & 3 deletions modules/core/include/nv_node/utilities/cpp_to_napi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,16 +246,16 @@ struct CPPToNapi {
if (std::is_same<T, uint16_t>() || std::is_same<T, unsigned short>()) {
return Napi::Uint16Array::New(Env(), len, buf, 0);
}
if (std::is_same<T, int32_t>()) { //
if (std::is_same<T, int32_t>()) { //
return Napi::Int32Array::New(Env(), len, buf, 0);
}
if (std::is_same<T, uint32_t>()) { //
return Napi::Uint32Array::New(Env(), len, buf, 0);
}
if (std::is_same<T, float>()) { //
if (std::is_same<T, float>()) { //
return Napi::Float32Array::New(Env(), len, buf, 0);
}
if (std::is_same<T, double>()) { //
if (std::is_same<T, double>()) { //
return Napi::Float64Array::New(Env(), len, buf, 0);
}
NAPI_THROW(std::runtime_error{"Unknown TypedArray type"}, env.Undefined());
Expand Down
4 changes: 2 additions & 2 deletions modules/core/include/nv_node/utilities/napi_to_cpp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,10 @@ struct NapiToCPP {
//
// Pointers
//
inline operator void*() const { //
inline operator void*() const { //
return static_cast<void*>(as_span<char>().data());
}
inline operator void const *() const { //
inline operator void const*() const { //
return static_cast<void const*>(as_span<char>().data());
}
template <typename T>
Expand Down
8 changes: 4 additions & 4 deletions modules/cuda/src/buffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -575,10 +575,10 @@ function toHDView<T extends TypedArray|BigIntArray>(
TypedArray: TypedArrayConstructor<T>): T|MemoryViewOf<T> {
if (source instanceof MemoryView) {
return (source.TypedArray === TypedArray)
// If source is already the desired type, return it
? source as MemoryViewOf<T>
// If source is another type of MemoryView, wrap in the desired type
: toMemoryView(source, TypedArray);
// If source is already the desired type, return it
? source as MemoryViewOf<T>
// If source is another type of MemoryView, wrap in the desired type
: toMemoryView(source, TypedArray);
} else if (isMemoryLike(source)) {
// If source is MemoryLike, wrap it in a MemoryView of the desired type
return toMemoryView(source, TypedArray);
Expand Down
36 changes: 18 additions & 18 deletions modules/cuda/src/math.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,60 +20,60 @@

namespace nv {

Napi::Value math_abs(CallbackArgs const &info) {
Napi::Value math_abs(CallbackArgs const& info) {
return nv::math::dispatch(nv::math::calc_abs{}, info);
}
Napi::Value math_acos(CallbackArgs const &info) {
Napi::Value math_acos(CallbackArgs const& info) {
return nv::math::dispatch(nv::math::calc_acos{}, info);
}
Napi::Value math_asin(CallbackArgs const &info) {
Napi::Value math_asin(CallbackArgs const& info) {
return nv::math::dispatch(nv::math::calc_asin{}, info);
}
Napi::Value math_atan(CallbackArgs const &info) {
Napi::Value math_atan(CallbackArgs const& info) {
return nv::math::dispatch(nv::math::calc_atan{}, info);
}
Napi::Value math_atan2(CallbackArgs const &info) {
Napi::Value math_atan2(CallbackArgs const& info) {
return nv::math::dispatch(nv::math::calc_atan2{}, info);
}
Napi::Value math_ceil(CallbackArgs const &info) {
Napi::Value math_ceil(CallbackArgs const& info) {
return nv::math::dispatch(nv::math::calc_ceil{}, info);
}
Napi::Value math_cos(CallbackArgs const &info) {
Napi::Value math_cos(CallbackArgs const& info) {
return nv::math::dispatch(nv::math::calc_cos{}, info);
}
Napi::Value math_exp(CallbackArgs const &info) {
Napi::Value math_exp(CallbackArgs const& info) {
return nv::math::dispatch(nv::math::calc_exp{}, info);
}
Napi::Value math_floor(CallbackArgs const &info) {
Napi::Value math_floor(CallbackArgs const& info) {
return nv::math::dispatch(nv::math::calc_floor{}, info);
}
Napi::Value math_log(CallbackArgs const &info) {
Napi::Value math_log(CallbackArgs const& info) {
return nv::math::dispatch(nv::math::calc_log{}, info);
}
Napi::Value math_max(CallbackArgs const &info) {
Napi::Value math_max(CallbackArgs const& info) {
return nv::math::dispatch(nv::math::calc_max{}, info);
}
Napi::Value math_min(CallbackArgs const &info) {
Napi::Value math_min(CallbackArgs const& info) {
return nv::math::dispatch(nv::math::calc_min{}, info);
}
Napi::Value math_pow(CallbackArgs const &info) {
Napi::Value math_pow(CallbackArgs const& info) {
return nv::math::dispatch(nv::math::calc_pow{}, info);
}
Napi::Value math_round(CallbackArgs const &info) {
Napi::Value math_round(CallbackArgs const& info) {
return nv::math::dispatch(nv::math::calc_round{}, info);
}
Napi::Value math_sin(CallbackArgs const &info) {
Napi::Value math_sin(CallbackArgs const& info) {
return nv::math::dispatch(nv::math::calc_sin{}, info);
}
Napi::Value math_sqrt(CallbackArgs const &info) {
Napi::Value math_sqrt(CallbackArgs const& info) {
return nv::math::dispatch(nv::math::calc_sqrt{}, info);
}
Napi::Value math_tan(CallbackArgs const &info) {
Napi::Value math_tan(CallbackArgs const& info) {
return nv::math::dispatch(nv::math::calc_tan{}, info);
}

namespace math {
Napi::Object initModule(Napi::Env const &env,
Napi::Object initModule(Napi::Env const& env,
Napi::Object exports,
Napi::Object driver,
Napi::Object runtime) {
Expand Down
12 changes: 4 additions & 8 deletions modules/cuda/src/node_cuda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ export declare namespace Math {

export declare namespace driver {
/** @ignore */
export enum PointerAttributes
{
export enum PointerAttributes {
CONTEXT,
MEMORY_TYPE,
DEVICE_POINTER,
Expand All @@ -72,8 +71,7 @@ export declare namespace runtime {
* Flags to register a graphics resource
* @ignore
*/
export enum GraphicsRegisterFlags
{
export enum GraphicsRegisterFlags {
NONE,
READ_ONLY,
WRITE_DISCARD,
Expand All @@ -100,8 +98,7 @@ export declare namespace runtime {
* CUDAArray channel format kind
* @ignore
*/
export declare enum ChannelFormatKind
{
export declare enum ChannelFormatKind {
/** Signed channel format */
SIGNED,
/** Unsigned channel format */
Expand Down Expand Up @@ -146,8 +143,7 @@ export declare class CUDAArray {
* interacts with the OS scheduler when waiting for results from the GPU.
* Only one of the scheduling flags can be set when creating a context.
*/
export declare enum DeviceFlags
{
export declare enum DeviceFlags {
/**
* Uses a heuristic based on the number of active CUDA contexts in the
* process `C` and the number of logical processors in the system `P`.
Expand Down
4 changes: 2 additions & 2 deletions modules/cuda/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const isIterable =
<T = any>(x: any): x is Iterable<T> => { return isObject(x) && isFunction(x[Symbol.iterator]);};

/** @ignore */
export const isAsyncIterable = <T = any>(x: any):
export const isAsyncIterable = <T = any>(x: any):
x is AsyncIterable<T> => { return isObject(x) && isFunction(x[Symbol.asyncIterator]);};

/** @ignore */
Expand All @@ -61,7 +61,7 @@ export const isArrayBufferLike = (x: any): x is ArrayBufferLike => {
export const isArrayBufferView = ArrayBuffer.isView;

/** @ignore */
export const isIteratorResult = <T = any>(x: any):
export const isIteratorResult = <T = any>(x: any):
x is IteratorResult<T> => { return isObject(x) && ('done' in x) && ('value' in x);};

/**
Expand Down
Loading

0 comments on commit cc16694

Please sign in to comment.