mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
synced 2025-05-14 16:58:34 +00:00
Merge branch 'master' of https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
Some checks failed
Build code on Linux / linux (Debug, clang++-15, -stdlib=libc++, sudo apt install clang-15 libc++-15-dev libc++abi-15-dev) (push) Has been cancelled
Build code on Linux / linux (Debug, g++-12, sudo apt install g++-12) (push) Has been cancelled
Build code on Linux / linux (Release, clang++-15, -stdlib=libc++, sudo apt install clang-15 libc++-15-dev libc++abi-15-dev) (push) Has been cancelled
Build code on Linux / linux (Release, g++-12, sudo apt install g++-12) (push) Has been cancelled
Static code analysis (clang-tidy) / clang-tidy (push) Has been cancelled
Build code / Windows MSVC (Debug) (push) Has been cancelled
Build code / Windows MSVC (Release) (push) Has been cancelled
Some checks failed
Build code on Linux / linux (Debug, clang++-15, -stdlib=libc++, sudo apt install clang-15 libc++-15-dev libc++abi-15-dev) (push) Has been cancelled
Build code on Linux / linux (Debug, g++-12, sudo apt install g++-12) (push) Has been cancelled
Build code on Linux / linux (Release, clang++-15, -stdlib=libc++, sudo apt install clang-15 libc++-15-dev libc++abi-15-dev) (push) Has been cancelled
Build code on Linux / linux (Release, g++-12, sudo apt install g++-12) (push) Has been cancelled
Static code analysis (clang-tidy) / clang-tidy (push) Has been cancelled
Build code / Windows MSVC (Debug) (push) Has been cancelled
Build code / Windows MSVC (Release) (push) Has been cancelled
This commit is contained in:
commit
f0dc115467
2 changed files with 106 additions and 27 deletions
57
.clang-tidy
Normal file
57
.clang-tidy
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
Checks:
|
||||||
|
- cert-*
|
||||||
|
- clang-analyzer-*
|
||||||
|
- bugprone-*
|
||||||
|
- performance-*
|
||||||
|
- readability-*
|
||||||
|
- modernize-*
|
||||||
|
- cppcoreguidelines-*
|
||||||
|
- misc-*
|
||||||
|
- '-altera-unroll-loops'
|
||||||
|
- '-bugprone-easily-swappable-parameters'
|
||||||
|
- '-bugprone-sizeof-expression'
|
||||||
|
- '-cppcoreguidelines-avoid-do-while'
|
||||||
|
- '-cppcoreguidelines-macro-usage'
|
||||||
|
- '-cppcoreguidelines-no-malloc'
|
||||||
|
- '-cppcoreguidelines-owning-memory'
|
||||||
|
- '-cppcoreguidelines-pro-bounds-array-to-pointer-decay'
|
||||||
|
- '-cppcoreguidelines-pro-bounds-constant-array-index'
|
||||||
|
- '-cppcoreguidelines-pro-bounds-pointer-arithmetic'
|
||||||
|
- '-cppcoreguidelines-pro-type-union-access'
|
||||||
|
- '-cppcoreguidelines-pro-type-vararg'
|
||||||
|
- '-llvmlibc-implementation-in-namespace'
|
||||||
|
- '-llvmlibc-restrict-system-libc-headers'
|
||||||
|
- '-misc-const-correctness'
|
||||||
|
- '-misc-definitions-in-headers'
|
||||||
|
- '-misc-no-recursion'
|
||||||
|
- '-misc-static-assert'
|
||||||
|
- '-misc-unused-parameters'
|
||||||
|
- '-modernize-use-auto'
|
||||||
|
- '-modernize-use-nodiscard'
|
||||||
|
- '-modernize-use-using'
|
||||||
|
- '-modernize-use-trailing-return-type'
|
||||||
|
- '-performance-enum-size'
|
||||||
|
- '-readability-braces-around-statements'
|
||||||
|
- '-readability-function-cognitive-complexity'
|
||||||
|
- '-readability-implicit-bool-conversion'
|
||||||
|
- '-readability-simplify-boolean-expr'
|
||||||
|
- '-readability-static-accessed-through-instance'
|
||||||
|
- '-readability-identifier-naming'
|
||||||
|
- '-readability-identifier-length'
|
||||||
|
|
||||||
|
HeaderFilterRegex: '.*\.(cpp|h)$'
|
||||||
|
FormatStyle: file
|
||||||
|
|
||||||
|
CheckOptions:
|
||||||
|
- key: 'modernize-loop-convert.MaxCopySize'
|
||||||
|
value: '16'
|
||||||
|
- key: 'readability-identifier-naming.VariableCase'
|
||||||
|
value: 'camelBack'
|
||||||
|
- key: 'readability-identifier-naming.ClassCase'
|
||||||
|
value: 'CamelCase'
|
||||||
|
- key: 'readability-identifier-naming.FunctionCase'
|
||||||
|
value: 'camelBack'
|
||||||
|
- key: 'cppcoreguidelines-avoid-magic-numbers.IgnoreEnums'
|
||||||
|
value: '1'
|
||||||
|
- key: 'cppcoreguidelines-avoid-magic-numbers.IgnoreOctalLiterals'
|
||||||
|
value: '1'
|
76
.github/workflows/static_code_analysis.yaml
vendored
76
.github/workflows/static_code_analysis.yaml
vendored
|
@ -1,4 +1,4 @@
|
||||||
name: Static code analysis (clang-tidy)
|
name: Static code analysis (clang-tidy)
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
@ -12,26 +12,39 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install dependencies
|
# Cache Vulkan SDK
|
||||||
|
- name: Cache Vulkan SDK
|
||||||
|
id: cache-vulkan
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: vulkan_sdk
|
||||||
|
key: vulkan-sdk-1.4.309.0
|
||||||
|
|
||||||
|
# Install system dependencies
|
||||||
|
- name: Install system dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install -y clang-15 clang-tidy-15 cmake ninja-build libc++-15-dev libc++abi-15-dev
|
sudo apt install -y clang-15 clang-tidy-15 cmake parallel libc++-15-dev libc++abi-15-dev
|
||||||
|
|
||||||
- name: Set clang-tidy version
|
# Download Vulkan SDK only if not cached
|
||||||
run: echo "CLANG_TIDY=clang-tidy-15" >> $GITHUB_ENV
|
- name: Download Vulkan SDK
|
||||||
|
if: steps.cache-vulkan.outputs.cache-hit != 'true'
|
||||||
- name: Prepare Vulkan SDK
|
|
||||||
run: |
|
run: |
|
||||||
curl -LS -o vulkansdk.tar.xz https://sdk.lunarg.com/sdk/download/1.4.309.0/linux/vulkansdk-linux-x86_64-1.4.309.0.tar.xz
|
curl -LS -o vulkansdk.tar.xz https://sdk.lunarg.com/sdk/download/1.4.309.0/linux/vulkansdk-linux-x86_64-1.4.309.0.tar.xz
|
||||||
mkdir -p vulkan_sdk
|
mkdir -p vulkan_sdk
|
||||||
tar xf vulkansdk.tar.xz -C vulkan_sdk
|
tar xf vulkansdk.tar.xz -C vulkan_sdk
|
||||||
export VULKAN_SDK=$GITHUB_WORKSPACE/vulkan_sdk/1.4.309.0/x86_64
|
|
||||||
echo "VULKAN_SDK=$VULKAN_SDK" >> $GITHUB_ENV
|
|
||||||
echo "PATH=$VULKAN_SDK/bin:$PATH" >> $GITHUB_ENV
|
|
||||||
echo "LD_LIBRARY_PATH=$VULKAN_SDK/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
|
|
||||||
echo "VK_ICD_FILENAMES=$VULKAN_SDK/etc/vulkan/icd.d" >> $GITHUB_ENV
|
|
||||||
echo "VK_LAYER_PATH=$VULKAN_SDK/etc/vulkan/layer.d" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
|
# Set environment variables for Clang and Vulkan SDK
|
||||||
|
- name: Set environment variables
|
||||||
|
run: |
|
||||||
|
echo "CLANG_TIDY=clang-tidy-15" >> $GITHUB_ENV
|
||||||
|
echo "VULKAN_SDK=${GITHUB_WORKSPACE}/vulkan_sdk/1.4.309.0/x86_64" >> $GITHUB_ENV
|
||||||
|
echo "PATH=${GITHUB_WORKSPACE}/vulkan_sdk/1.4.309.0/x86_64/bin:$PATH" >> $GITHUB_ENV
|
||||||
|
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/vulkan_sdk/1.4.309.0/x86_64/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
|
||||||
|
echo "VK_ICD_FILENAMES=${GITHUB_WORKSPACE}/vulkan_sdk/1.4.309.0/x86_64/etc/vulkan/icd.d" >> $GITHUB_ENV
|
||||||
|
echo "VK_LAYER_PATH=${GITHUB_WORKSPACE}/vulkan_sdk/1.4.309.0/x86_64/etc/vulkan/layer.d" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
# Configure the project with CMake
|
||||||
- name: Configure with CMake
|
- name: Configure with CMake
|
||||||
run: |
|
run: |
|
||||||
cmake -S . -B build \
|
cmake -S . -B build \
|
||||||
|
@ -40,18 +53,27 @@ jobs:
|
||||||
-DCMAKE_C_COMPILER=clang-15 \
|
-DCMAKE_C_COMPILER=clang-15 \
|
||||||
-DVMA_BUILD_SAMPLES=YES
|
-DVMA_BUILD_SAMPLES=YES
|
||||||
|
|
||||||
- name: Run Clang-Tidy
|
# List files to analyze
|
||||||
|
- name: Check the files found for clang-tidy
|
||||||
run: |
|
run: |
|
||||||
find . -name '*.cpp' | xargs clang-tidy-15 -checks='*, \
|
find src include \
|
||||||
-modernize-use-trailing-return-type, \
|
-path '*/_deps/*' -prune -o \
|
||||||
-cppcoreguidelines-macro-usage, \
|
-path '*/build/*' -prune -o \
|
||||||
-modernize-use-auto, \
|
\( -name '*.cpp' -o -name '*.hpp' \) -print
|
||||||
-modernize-use-using \
|
|
||||||
-modernize-use-nodiscard \
|
# Run clang-tidy in parallel
|
||||||
-altera-unroll-loops \
|
- name: Run clang-tidy
|
||||||
-misc-definitions-in-headers \
|
run: |
|
||||||
-cppcoreguidelines-pro-bounds-pointer-arithmetic \
|
find src include \
|
||||||
-readability-function-cognitive-complexity \
|
-path '*/_deps/*' -prune -o \
|
||||||
-llvmlibc-restrict-system-libc-headers \
|
-path '*/build/*' -prune -o \
|
||||||
-cppcoreguidelines-pro-type-union-access' \
|
\( -name '*.cpp' -o -name '*.hpp' \) -print0 |
|
||||||
-header-filter='.*vk_mem_alloc\.h' -p build || true
|
parallel -0 clang-tidy -p build {} |
|
||||||
|
tee output || true
|
||||||
|
|
||||||
|
# Summarize warnings
|
||||||
|
- name: Summarize clang-tidy warnings
|
||||||
|
run: |
|
||||||
|
grep -hEo '\[[a-z0-9]+-[a-z0-9-]+\]' output \
|
||||||
|
| sort | uniq -c | sort -nr \
|
||||||
|
| sed 's/[][]//g' || true
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue