diff options
| author | Ellie Hermaszewska <ellieh@nvidia.com> | 2024-10-29 13:59:28 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-29 13:59:28 +0800 |
| commit | a729c15e9dce9f5116a38afc66329ab2ca4cea54 (patch) | |
| tree | 9580072eb0d796b51c04ad5be95230a747709150 /source/slang | |
| parent | a15d770242f88aa4b33cd7d3a97de9c8d86a2315 (diff) | |
preparation for clang format (#5422)
* Clang-format excludes
* Add .clang-format
* Don't clang-format in external
* Missing includes and forward declarations
* Replace wonky include-once macro name
* neaten include naming
* Add clang-format to formatting script
* Add xargs and diff to required binaries
* add clang-format to ci formatting check
* Add max version check to formatting script
* temporarily disable checking formatting for cpp files
Diffstat (limited to 'source/slang')
| -rw-r--r-- | source/slang/slang-ast-iterator.h | 1 | ||||
| -rw-r--r-- | source/slang/slang-ast-support-types.h | 2 | ||||
| -rw-r--r-- | source/slang/slang-ast-val.h | 1 | ||||
| -rw-r--r--[-rwxr-xr-x] | source/slang/slang-compiler.h | 0 | ||||
| -rw-r--r-- | source/slang/slang-emit-precedence.h | 4 | ||||
| -rw-r--r-- | source/slang/slang-ir-inst-defs.h | 2 | ||||
| -rw-r--r-- | source/slang/slang-ir-variable-scope-correction.h | 1 | ||||
| -rw-r--r-- | source/slang/slang-repro.cpp | 4 | ||||
| -rw-r--r-- | source/slang/slang-serialize-types.cpp | 7 | ||||
| -rw-r--r-- | source/slang/slang-syntax.cpp | 2 | ||||
| -rw-r--r-- | source/slang/slang-type-layout.h | 2 |
11 files changed, 23 insertions, 3 deletions
diff --git a/source/slang/slang-ast-iterator.h b/source/slang/slang-ast-iterator.h index c6f74fdf8..bbabb8ab5 100644 --- a/source/slang/slang-ast-iterator.h +++ b/source/slang/slang-ast-iterator.h @@ -1,5 +1,6 @@ #pragma once #include "slang-syntax.h" +#include "slang-visitor.h" namespace Slang { diff --git a/source/slang/slang-ast-support-types.h b/source/slang/slang-ast-support-types.h index e35f970f5..3b10539cf 100644 --- a/source/slang/slang-ast-support-types.h +++ b/source/slang/slang-ast-support-types.h @@ -9,7 +9,7 @@ #include "slang-profile.h" #include "slang-type-system-shared.h" -#include "../../include/slang.h" +#include "slang.h" #include "../core/slang-semantic-version.h" diff --git a/source/slang/slang-ast-val.h b/source/slang/slang-ast-val.h index 8752195cb..98161596d 100644 --- a/source/slang/slang-ast-val.h +++ b/source/slang/slang-ast-val.h @@ -3,6 +3,7 @@ #pragma once #include "slang-ast-base.h" +#include "slang-ast-decl.h" namespace Slang { diff --git a/source/slang/slang-compiler.h b/source/slang/slang-compiler.h index 67c931ac8..67c931ac8 100755..100644 --- a/source/slang/slang-compiler.h +++ b/source/slang/slang-compiler.h diff --git a/source/slang/slang-emit-precedence.h b/source/slang/slang-emit-precedence.h index f23287bcb..75a45c7ce 100644 --- a/source/slang/slang-emit-precedence.h +++ b/source/slang/slang-emit-precedence.h @@ -26,6 +26,7 @@ namespace Slang // x macro of precedence of types in order. // Used because in header, need to prefix macros to avoid clashes, and this style allows for prefixing without additional clutter +// clang-format off #define SLANG_PRECEDENCE(x) \ x(None, NON_ASSOC) \ x(Comma, LEFT) \ @@ -50,6 +51,7 @@ namespace Slang x(Prefix, RIGHT) \ x(Postfix, LEFT) \ x(Atomic, NON_ASSOC) +// clang-format on // Precedence enum produced from the SLANG_PRECEDENCE macro enum EPrecedence @@ -59,6 +61,7 @@ enum EPrecedence // Macro for define OpInfo and an associated enum type. Order or macro parameters is // Op, OpName, Precedence +// clang-format off #define SLANG_OP_INFO(x) \ x(None, "", None) \ \ @@ -111,6 +114,7 @@ enum EPrecedence x(Not, "!", Prefix) \ x(Neg, "-", Prefix) \ x(BitNot, "~", Prefix) +// clang-format on #define SLANG_OP_INFO_ENUM(op, name, precedence) op, diff --git a/source/slang/slang-ir-inst-defs.h b/source/slang/slang-ir-inst-defs.h index f4365cf62..c98fae55e 100644 --- a/source/slang/slang-ir-inst-defs.h +++ b/source/slang/slang-ir-inst-defs.h @@ -1,5 +1,7 @@ // slang-ir-inst-defs.h +// clang-format off + #ifndef INST #error Must #define `INST` before including `ir-inst-defs.h` #endif diff --git a/source/slang/slang-ir-variable-scope-correction.h b/source/slang/slang-ir-variable-scope-correction.h index 5f958f9d0..9694689d9 100644 --- a/source/slang/slang-ir-variable-scope-correction.h +++ b/source/slang/slang-ir-variable-scope-correction.h @@ -6,6 +6,7 @@ namespace Slang { struct IRModule; +class TargetRequest; /// This pass correct the scope of variables in loop regions /// diff --git a/source/slang/slang-repro.cpp b/source/slang/slang-repro.cpp index 32f8d3289..4e5a03bc3 100644 --- a/source/slang/slang-repro.cpp +++ b/source/slang/slang-repro.cpp @@ -26,6 +26,7 @@ namespace Slang { // to set up the thing to hash. // // Note that bool is in the list because size of bool can change between compilers. +// clang-format off #define SLANG_STATE_TYPES(x) \ x(Util::FileState) \ x(Util::PathInfoState) \ @@ -52,7 +53,8 @@ namespace Slang { x(OptimizationLevel) \ x(ContainerFormat) \ x(PassThroughMode) \ - x(SlangMatrixLayoutMode) \ + x(SlangMatrixLayoutMode) +// clang-format on #define SLANG_STATE_TYPE_SIZE(x) uint32_t(sizeof(x)), diff --git a/source/slang/slang-serialize-types.cpp b/source/slang/slang-serialize-types.cpp index a091a2850..cab108b1a 100644 --- a/source/slang/slang-serialize-types.cpp +++ b/source/slang/slang-serialize-types.cpp @@ -208,9 +208,11 @@ struct ByteReader // !!!!!!!!!!!!!!!!!!!!!!!!!!!! SerialParseUtil !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +// clang-format off #define SLANG_SERIAL_BINARY_COMPRESSION_TYPE(x) \ x(None, none) \ x(VariableByteLite, lite) +// clang-format on /* static */SlangResult SerialParseUtil::parseCompressionType(const UnownedStringSlice& text, SerialCompressionType& outType) { @@ -220,7 +222,10 @@ struct ByteReader SerialCompressionType type; }; -#define SLANG_SERIAL_BINARY_PAIR(type, name) { UnownedStringSlice::fromLiteral(#name), SerialCompressionType::type}, +// clang-format off +#define SLANG_SERIAL_BINARY_PAIR(type, name) \ + {UnownedStringSlice::fromLiteral(#name), SerialCompressionType::type}, +// clang-format on static const Pair s_pairs[] = { diff --git a/source/slang/slang-syntax.cpp b/source/slang/slang-syntax.cpp index 8422a304b..053064755 100644 --- a/source/slang/slang-syntax.cpp +++ b/source/slang/slang-syntax.cpp @@ -912,10 +912,12 @@ bool findImageFormatByName(const UnownedStringSlice& name, ImageFormat* outForma } // https://github.com/microsoft/DirectXShaderCompiler/blob/main/docs/SPIR-V.rst#id71 +// clang-format off #define SLANG_VK_TO_IMAGE_FORMAT(x) \ x(r11g11b10f, r11f_g11f_b10f) \ x(rgb10a2, rgb10_a2) \ x(rgb10a2ui, rgb10_a2ui) +// clang-format on struct VkImageFormatInfo { diff --git a/source/slang/slang-type-layout.h b/source/slang/slang-type-layout.h index 4248df508..d932b4f16 100644 --- a/source/slang/slang-type-layout.h +++ b/source/slang/slang-type-layout.h @@ -244,6 +244,7 @@ struct UniformArrayLayoutInfo : UniformLayoutInfo typedef slang::ParameterCategory LayoutResourceKind; // Any change to slang::ParameterCategory, requires a change to this macro. +// clang-format off #define SLANG_PARAMETER_CATEGORIES(x) \ x(None) \ x(Mixed) \ @@ -277,6 +278,7 @@ typedef slang::ParameterCategory LayoutResourceKind; x(MetalBuffer) \ x(MetalTexture) \ x(MetalArgumentBufferElement) +// clang-format on #define SLANG_PARAMETER_CATEGORY_FLAG(x) x = ParameterCategoryFlags(1) << int(slang::x), |
