Skip to content

Commit

Permalink
[FEA] Update to llvm 17 (#465)
Browse files Browse the repository at this point in the history
* update devel container to llvm-17

* add .clangd config file

* symlink .env file

* update eslint versions

* reduce eslint run time

* fix lint

* update yarn.lock

* remove duplicate clang-format entry

* use maintained clang-format plugin

* run clang-format
  • Loading branch information
trxcllnt committed Aug 25, 2023
1 parent c9fddaf commit 7fb887c
Show file tree
Hide file tree
Showing 71 changed files with 782 additions and 607 deletions.
72 changes: 48 additions & 24 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
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
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: true
Expand All @@ -20,8 +23,9 @@ AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
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 @@ -156,45 +169,45 @@ UseTab: Never
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
Language: JavaScript
#########################################################
#
#
# Additions or modifications to the above C++ settings
#
#
#########################################################
AccessModifierOffset: 0
AlignArrayOfStructures: None
AllowAllArgumentsOnNextLine: true
AlignConsecutiveBitFields: true
AllowShortEnumsOnASingleLine: false
AllowShortLambdasOnASingleLine: All
BitFieldColonSpacing: After
BreakStringLiterals: false
InsertTrailingCommas: None
IndentCaseBlocks: false
JavaScriptQuotes: Single
JavaScriptWrapImports: true
PointerAlignment: Middle
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAroundPointerQualifiers: Both
SpaceBeforeCpp11BracedList: true
SpaceBeforeSquareBrackets: false
SpaceBeforeCtorInitializerColon: false
SpaceBeforeJsonColon: false
SpaceBeforeInheritanceColon: false
SpaceBeforeRangeBasedForLoopColon: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: false
#########################################################
#
#
# Begin previous C++ settings
#
#
#########################################################
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AlignOperands: AlignAfterOperator
AlignTrailingComments:
Kind: Always
OverEmptyLines: 2
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: true
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: true
Expand All @@ -204,8 +217,9 @@ AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackArguments: false
BinPackParameters: false
BitFieldColonSpacing: After
BraceWrapping:
AfterClass: false
AfterControlStatement: false
Expand All @@ -223,6 +237,8 @@ BraceWrapping:
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
BreakArrays: false
BreakAfterAttributes: Leave
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
Expand All @@ -239,7 +255,7 @@ ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 2
ContinuationIndentWidth: 2
Cpp11BracedListStyle: true
DerivePointerAlignment: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
Expand All @@ -262,7 +278,7 @@ IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 2
IndentWrappedFunctionNames: false
JavaScriptWrapImports: true
InsertNewlineAtEOF: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
Expand All @@ -280,6 +296,8 @@ PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
ReferenceAlignment: Left
RawStringFormats:
- Language: JavaScript
Delimiters:
Expand Down Expand Up @@ -314,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
73 changes: 73 additions & 0 deletions .clangd
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# https://clangd.llvm.org/config

# Apply a config conditionally to all C files
If:
PathMatch: .*\.(c|h)$

---

# Apply a config conditionally to all C++ files
If:
PathMatch: .*\.(c|h)pp

---

# Apply a config conditionally to all CUDA files
If:
PathMatch: .*\.cuh?

Diagnostics:
Suppress:
- "variadic_device_fn"
- "attributes_not_allowed"

CompileFlags:
Add:
- "-x"
- "cuda"
# No error on unknown CUDA versions
- "-Wno-unknown-cuda-version"
# Allow variadic CUDA functions
- "-Xclang=-fcuda-allow-variadic-functions"

---

# Tweak the clangd parse settings for all files
Hover:
ShowAKA: Yes

InlayHints:
Enabled: No

CompileFlags:
Add:
# report all errors
- "-ferror-limit=0"
- "-fmacro-backtrace-limit=0"
- "-ftemplate-backtrace-limit=0"
# Skip the CUDA version check
- "--no-cuda-version-check"
Remove:
# remove gcc's -fcoroutines
- -fcoroutines
# remove nvc++ flags unknown to clang
- "-gpu=*"
- "-stdpar*"
# remove nvcc flags unknown to clang
- "-arch*"
- "-gencode*"
- "--generate-code*"
- "-ccbin*"
- "-t=*"
- "--threads*"
- "-Xptxas*"
- "-Xcudafe*"
- "-Xfatbin*"
- "-Xcompiler*"
- "--diag-suppress*"
- "--diag_suppress*"
- "--compiler-options*"
- "--expt-extended-lambda"
- "--expt-relaxed-constexpr"
- "-forward-unknown-to-host-compiler"
- "-Werror=cross-execution-space-call"
5 changes: 2 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ module.exports = {
'parser': '@typescript-eslint/parser',
'parserOptions': {
'project': [
'tsconfig.json',
'modules/**/*/tsconfig.json',
'modules/**/*/test/tsconfig.json',
'tsconfig.json'
],
'sourceType': 'module'
},
Expand All @@ -23,6 +21,7 @@ module.exports = {
// "prefer-const": "off",
// "prefer-rest-params": "off",
'semi': ['error', 'always'],
'@typescript-eslint/unbound-method': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-var-requires': 'off',
Expand Down
12 changes: 7 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
**/z-*
**/*.log
**/doc
**/lib
**/build
**/doc/
**/lib/
**/build/
**/.cache
**/.clangd
**/.ccache
**/__pycache__
**/node_modules
**/__pycache__/
**/node_modules/
**/compile_commands.json

/dev/.ssh/*
Expand Down Expand Up @@ -35,3 +35,5 @@ internal/*
**/.next/
**/_next/
**/out/

!/.clangd
12 changes: 4 additions & 8 deletions dev/dockerfiles/devel/main.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ ONBUILD ARG ADDITIONAL_GROUPS="--groups sudo,video"

FROM compilers as main-amd64

ONBUILD ARG LLDB_VERSION=12
ONBUILD ARG CLANGD_VERSION=12
ONBUILD ARG CLANG_FORMAT_VERSION=12
ONBUILD ARG LLDB_VERSION=17
ONBUILD ARG CLANGD_VERSION=17
ONBUILD ARG CLANG_FORMAT_VERSION=17

# Install dependencies and dev tools (llnode etc.)
ONBUILD RUN export DEBIAN_FRONTEND=noninteractive \
Expand Down Expand Up @@ -187,11 +187,7 @@ deb-src http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -c
&& update-alternatives --set lldb /usr/bin/lldb-${LLDB_VERSION} \
\
# Globally install llnode
&& mkdir -p /usr/local/lib/llnode \
&& wget -O - https://github.com/trxcllnt/llnode/archive/refs/heads/use-llvm-project-monorepo.tar.gz \
| tar -C /usr/local/lib/llnode -xzf - --strip-components=1 \
&& npm pack --pack-destination /usr/local/lib/llnode /usr/local/lib/llnode \
&& npm install --location=global --unsafe-perm --no-audit --no-fund --no-update-notifier /usr/local/lib/llnode/llnode-*.tgz \
&& npm install --location global --unsafe-perm --no-audit --no-fund --no-update-notifier llnode \
&& echo "llnode: $(which -a llnode)" \
&& echo "llnode version: $(llnode --version)" \
\
Expand Down
2 changes: 1 addition & 1 deletion docs/develop-on-bare-metal.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The following dependencies are necessary to build any of the `node-rapids` nativ
* [CMake v3.20.2+](https://cmake.org/) (recommend either the [apt repository](https://apt.kitware.com/) or self-installing shell script).
* `gcc-9` toolchain (available in Ubuntu via the official toolchain PPA `ppa:ubuntu-toolchain-r/test`)
* ```txt
ninja-build sccache jq zlib1g-dev liblz4-dev clang-format-12 clangd-12 lldb-12
ninja-build sccache jq zlib1g-dev liblz4-dev clang-format-17 clangd-17 lldb-17
```

### Additional per-module dependencies
Expand Down
Loading

0 comments on commit 7fb887c

Please sign in to comment.