summaryrefslogtreecommitdiffstats
path: root/source/core
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2024-10-29 13:59:28 +0800
committerGitHub <noreply@github.com>2024-10-29 13:59:28 +0800
commita729c15e9dce9f5116a38afc66329ab2ca4cea54 (patch)
tree9580072eb0d796b51c04ad5be95230a747709150 /source/core
parenta15d770242f88aa4b33cd7d3a97de9c8d86a2315 (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/core')
-rw-r--r--source/core/slang-blob.h2
-rw-r--r--source/core/slang-chunked-list.h2
-rw-r--r--source/core/slang-common.h6
-rw-r--r--source/core/slang-crypto.h2
-rw-r--r--source/core/slang-file-system.h2
-rw-r--r--source/core/slang-free-list.h2
-rw-r--r--source/core/slang-hash.h2
-rw-r--r--source/core/slang-hex-dump-util.h2
-rw-r--r--source/core/slang-http.h2
-rw-r--r--source/core/slang-io.cpp9
-rw-r--r--source/core/slang-linked-list.h3
-rw-r--r--source/core/slang-list.h2
-rw-r--r--source/core/slang-math.h1
-rw-r--r--source/core/slang-memory-arena.h2
-rw-r--r--source/core/slang-persistent-cache.h2
-rw-r--r--source/core/slang-platform.h2
-rw-r--r--source/core/slang-random-generator.h2
-rw-r--r--source/core/slang-shared-library.h2
-rw-r--r--source/core/slang-short-list.h2
-rw-r--r--source/core/slang-smart-pointer.h3
-rw-r--r--source/core/slang-type-convert-util.h2
-rw-r--r--source/core/slang-type-text-util.cpp2
-rw-r--r--source/core/slang-type-text-util.h2
23 files changed, 32 insertions, 26 deletions
diff --git a/source/core/slang-blob.h b/source/core/slang-blob.h
index 2b752b306..4df8f0db6 100644
--- a/source/core/slang-blob.h
+++ b/source/core/slang-blob.h
@@ -1,7 +1,7 @@
#ifndef SLANG_CORE_BLOB_H
#define SLANG_CORE_BLOB_H
-#include "../../include/slang.h"
+#include "slang.h"
#include "slang-string.h"
#include "slang-list.h"
diff --git a/source/core/slang-chunked-list.h b/source/core/slang-chunked-list.h
index f963ecfab..d414eaefb 100644
--- a/source/core/slang-chunked-list.h
+++ b/source/core/slang-chunked-list.h
@@ -1,7 +1,7 @@
#ifndef SLANG_CORE_CHUNKED_LIST_H
#define SLANG_CORE_CHUNKED_LIST_H
-#include "../../include/slang.h"
+#include "slang.h"
#include "slang-allocator.h"
#include "slang-array-view.h"
diff --git a/source/core/slang-common.h b/source/core/slang-common.h
index 8c84894ca..2952eccd2 100644
--- a/source/core/slang-common.h
+++ b/source/core/slang-common.h
@@ -1,7 +1,6 @@
-#ifndef SLANG_CORE_COMMON_H
-#define SLANG_CORE_COMMON_H
+#pragma once
-#include "../../include/slang.h"
+#include "slang.h"
#include <assert.h>
@@ -237,7 +236,6 @@ template<typename T> void slang_use_obj(T&) {}
#define SLANG_UNREFERENCED_PARAMETER(P) slang_use_obj(P)
#define SLANG_UNREFERENCED_VARIABLE(P) slang_use_obj(P)
-#endif
#if defined(SLANG_RT_DYNAMIC)
#if defined(_MSC_VER)
diff --git a/source/core/slang-crypto.h b/source/core/slang-crypto.h
index c6cd733e7..feab88aa4 100644
--- a/source/core/slang-crypto.h
+++ b/source/core/slang-crypto.h
@@ -1,5 +1,5 @@
#pragma once
-#include "../../include/slang.h"
+#include "slang.h"
#include "../core/slang-string.h"
#include "../core/slang-blob.h"
#include "../core/slang-list.h"
diff --git a/source/core/slang-file-system.h b/source/core/slang-file-system.h
index 7de5b5dbd..dad2731d9 100644
--- a/source/core/slang-file-system.h
+++ b/source/core/slang-file-system.h
@@ -1,7 +1,7 @@
#ifndef SLANG_FILE_SYSTEM_H_INCLUDED
#define SLANG_FILE_SYSTEM_H_INCLUDED
-#include "../../include/slang.h"
+#include "slang.h"
#include "slang-com-helper.h"
#include "slang-com-ptr.h"
diff --git a/source/core/slang-free-list.h b/source/core/slang-free-list.h
index 97aee5bc9..5c4e55607 100644
--- a/source/core/slang-free-list.h
+++ b/source/core/slang-free-list.h
@@ -1,7 +1,7 @@
#ifndef SLANG_CORE_FREE_LIST_H
#define SLANG_CORE_FREE_LIST_H
-#include "../../include/slang.h"
+#include "slang.h"
#include "slang-common.h"
diff --git a/source/core/slang-hash.h b/source/core/slang-hash.h
index ff0cdc181..12239221b 100644
--- a/source/core/slang-hash.h
+++ b/source/core/slang-hash.h
@@ -1,8 +1,8 @@
#ifndef SLANG_CORE_HASH_H
#define SLANG_CORE_HASH_H
-#include "../../include/slang.h"
#include "slang-math.h"
+#include "slang.h"
#include "../../external/unordered_dense/include/ankerl/unordered_dense.h"
diff --git a/source/core/slang-hex-dump-util.h b/source/core/slang-hex-dump-util.h
index 6dcabf2ef..037355f2d 100644
--- a/source/core/slang-hex-dump-util.h
+++ b/source/core/slang-hex-dump-util.h
@@ -5,7 +5,7 @@
#include "slang-string.h"
#include "slang-list.h"
-#include "../../include/slang.h"
+#include "slang.h"
namespace Slang
{
diff --git a/source/core/slang-http.h b/source/core/slang-http.h
index 09f2fd91e..11d834bd8 100644
--- a/source/core/slang-http.h
+++ b/source/core/slang-http.h
@@ -1,7 +1,7 @@
#ifndef SLANG_CORE_HTTP_H
#define SLANG_CORE_HTTP_H
-#include "../../include/slang.h"
+#include "slang.h"
#include "slang-string.h"
#include "slang-list.h"
diff --git a/source/core/slang-io.cpp b/source/core/slang-io.cpp
index 928026267..edd21639b 100644
--- a/source/core/slang-io.cpp
+++ b/source/core/slang-io.cpp
@@ -15,9 +15,12 @@
#include <sys/stat.h>
#ifdef _WIN32
-# include <direct.h>
-# include <windows.h>
-# include <shellapi.h>
+// clang-format off
+// include ordering sensitive
+# include <windows.h>
+# include <direct.h>
+# include <shellapi.h>
+// clang-format on
#endif
#if defined(__linux__) || defined(__CYGWIN__) || SLANG_APPLE_FAMILY || SLANG_WASM
diff --git a/source/core/slang-linked-list.h b/source/core/slang-linked-list.h
index 496eddb1a..ff8f7ce40 100644
--- a/source/core/slang-linked-list.h
+++ b/source/core/slang-linked-list.h
@@ -1,9 +1,10 @@
#ifndef SLANG_CORE_LINKED_LIST_H
#define SLANG_CORE_LINKED_LIST_H
-#include "../../include/slang.h"
+#include "slang.h"
#include "slang-allocator.h"
+#include "slang-list.h"
#include <type_traits>
namespace Slang
diff --git a/source/core/slang-list.h b/source/core/slang-list.h
index 0b7b803bf..b1c67e438 100644
--- a/source/core/slang-list.h
+++ b/source/core/slang-list.h
@@ -1,7 +1,7 @@
#ifndef SLANG_CORE_LIST_H
#define SLANG_CORE_LIST_H
-#include "../../include/slang.h"
+#include "slang.h"
#include "slang-allocator.h"
#include "slang-math.h"
diff --git a/source/core/slang-math.h b/source/core/slang-math.h
index 231e59007..51ada76a9 100644
--- a/source/core/slang-math.h
+++ b/source/core/slang-math.h
@@ -1,6 +1,7 @@
#ifndef SLANG_CORE_MATH_H
#define SLANG_CORE_MATH_H
+#include "slang.h"
#include <cmath>
namespace Slang
diff --git a/source/core/slang-memory-arena.h b/source/core/slang-memory-arena.h
index 1d899b064..cbd0fdc56 100644
--- a/source/core/slang-memory-arena.h
+++ b/source/core/slang-memory-arena.h
@@ -1,7 +1,7 @@
#ifndef SLANG_CORE_MEMORY_ARENA_H
#define SLANG_CORE_MEMORY_ARENA_H
-#include "../../include/slang.h"
+#include "slang.h"
#include <stdlib.h>
#include <string.h>
diff --git a/source/core/slang-persistent-cache.h b/source/core/slang-persistent-cache.h
index 1411b9094..e7d02b861 100644
--- a/source/core/slang-persistent-cache.h
+++ b/source/core/slang-persistent-cache.h
@@ -1,8 +1,8 @@
#pragma once
-#include "../../include/slang.h"
#include "../core/slang-crypto.h"
#include "../core/slang-io.h"
#include "../core/slang-string.h"
+#include "slang.h"
#include <mutex>
diff --git a/source/core/slang-platform.h b/source/core/slang-platform.h
index 57a624e6d..81bae88d6 100644
--- a/source/core/slang-platform.h
+++ b/source/core/slang-platform.h
@@ -2,8 +2,8 @@
#ifndef SLANG_CORE_PLATFORM_H
#define SLANG_CORE_PLATFORM_H
-#include "../../include/slang.h"
#include "../core/slang-string.h"
+#include "slang.h"
namespace Slang
{
diff --git a/source/core/slang-random-generator.h b/source/core/slang-random-generator.h
index be416c8e2..fa83fec3b 100644
--- a/source/core/slang-random-generator.h
+++ b/source/core/slang-random-generator.h
@@ -1,7 +1,7 @@
#ifndef SLANG_CORE_RANDOM_GENERATOR_H
#define SLANG_CORE_RANDOM_GENERATOR_H
-#include "../../include/slang.h"
+#include "slang.h"
#include <stdlib.h>
#include <string.h>
diff --git a/source/core/slang-shared-library.h b/source/core/slang-shared-library.h
index ede5b1615..d6c1618ec 100644
--- a/source/core/slang-shared-library.h
+++ b/source/core/slang-shared-library.h
@@ -1,7 +1,7 @@
#ifndef SLANG_CORE_SHARED_LIBRARY_H
#define SLANG_CORE_SHARED_LIBRARY_H
-#include "../../include/slang.h"
+#include "slang.h"
#include "slang-com-helper.h"
#include "slang-com-ptr.h"
diff --git a/source/core/slang-short-list.h b/source/core/slang-short-list.h
index f40223a32..66165fc72 100644
--- a/source/core/slang-short-list.h
+++ b/source/core/slang-short-list.h
@@ -1,7 +1,7 @@
#ifndef SLANG_CORE_SHORT_LIST_H
#define SLANG_CORE_SHORT_LIST_H
-#include "../../include/slang.h"
+#include "slang.h"
#include "slang-allocator.h"
#include "slang-math.h"
diff --git a/source/core/slang-smart-pointer.h b/source/core/slang-smart-pointer.h
index 2f1f485dc..a45f7a8ad 100644
--- a/source/core/slang-smart-pointer.h
+++ b/source/core/slang-smart-pointer.h
@@ -4,8 +4,9 @@
#include "slang-common.h"
#include "slang-hash.h"
#include "slang-type-traits.h"
+#include "slang.h"
-#include "../../include/slang.h"
+#include "slang.h"
namespace Slang
{
diff --git a/source/core/slang-type-convert-util.h b/source/core/slang-type-convert-util.h
index 0fd221450..70565b896 100644
--- a/source/core/slang-type-convert-util.h
+++ b/source/core/slang-type-convert-util.h
@@ -1,7 +1,7 @@
#ifndef SLANG_CORE_TYPE_CONVERT_UTIL_H
#define SLANG_CORE_TYPE_CONVERT_UTIL_H
-#include "../../include/slang.h"
+#include "slang.h"
namespace Slang
{
diff --git a/source/core/slang-type-text-util.cpp b/source/core/slang-type-text-util.cpp
index f02325792..51ed2060e 100644
--- a/source/core/slang-type-text-util.cpp
+++ b/source/core/slang-type-text-util.cpp
@@ -9,6 +9,7 @@ namespace Slang
namespace { // anonymous
+// clang-format off
#define SLANG_SCALAR_TYPES(x) \
x(None, none) \
x(Void, void) \
@@ -20,6 +21,7 @@ namespace { // anonymous
x(UInt64, uint64_t) \
x(Float32, float) \
x(Float64, double)
+// clang-format on
struct ScalarTypeInfo
{
diff --git a/source/core/slang-type-text-util.h b/source/core/slang-type-text-util.h
index 1e1c25364..6d07e7d58 100644
--- a/source/core/slang-type-text-util.h
+++ b/source/core/slang-type-text-util.h
@@ -1,7 +1,7 @@
#ifndef SLANG_CORE_TYPE_TEXT_UTIL_H
#define SLANG_CORE_TYPE_TEXT_UTIL_H
-#include "../../include/slang.h"
+#include "slang.h"
#include "slang-string.h"
#include "slang-array-view.h"