From 09054bff3d0874a92958b514ae2a9ff2b32483e5 Mon Sep 17 00:00:00 2001 From: Sam Estep Date: Mon, 18 Aug 2025 11:10:27 -0400 Subject: Don't let clang-format reorder Fiddle `#include`s (#7887) The documentation added by #6844 included instructions to make sure that the Fiddle `#include` in a file comes after all the other `#include`s, but it's easy to accidentally violate this via `clang-format`, as happened for `source/slang/slang-ast-modifier.h` in #7559. This PR guards against this sort of violation by separating all Fiddle `#include`s from other `#include`s via a blank line followed by a `//` line (as we already do in most cases), and also adds a sentence about this in `tools/slang-fiddle/README.md`. As a bonus, I also enabled Markdown syntax highlighting for all the code blocks in that doc file. Co-authored-by: Ellie Hermaszewska --- source/slang/slang-ast-expr.h | 2 ++ source/slang/slang-ast-modifier.h | 4 +++- source/slang/slang-ast-stmt.h | 2 ++ source/slang/slang-ast-val.h | 2 ++ 4 files changed, 9 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/slang/slang-ast-expr.h b/source/slang/slang-ast-expr.h index 32c724e10..adbc7a2ba 100644 --- a/source/slang/slang-ast-expr.h +++ b/source/slang/slang-ast-expr.h @@ -2,6 +2,8 @@ #pragma once #include "slang-ast-base.h" + +// #include "slang-ast-expr.h.fiddle" FIDDLE() diff --git a/source/slang/slang-ast-modifier.h b/source/slang/slang-ast-modifier.h index b5fa25418..2f9c29d6c 100644 --- a/source/slang/slang-ast-modifier.h +++ b/source/slang/slang-ast-modifier.h @@ -2,9 +2,11 @@ #pragma once #include "slang-ast-base.h" -#include "slang-ast-modifier.h.fiddle" #include "slang-ir-insts-enum.h" +// +#include "slang-ast-modifier.h.fiddle" + FIDDLE() namespace Slang { diff --git a/source/slang/slang-ast-stmt.h b/source/slang/slang-ast-stmt.h index f5436a70e..485ddd439 100644 --- a/source/slang/slang-ast-stmt.h +++ b/source/slang/slang-ast-stmt.h @@ -2,6 +2,8 @@ #pragma once #include "slang-ast-base.h" + +// #include "slang-ast-stmt.h.fiddle" FIDDLE() diff --git a/source/slang/slang-ast-val.h b/source/slang/slang-ast-val.h index f371d76fe..a381410b6 100644 --- a/source/slang/slang-ast-val.h +++ b/source/slang/slang-ast-val.h @@ -3,6 +3,8 @@ #include "slang-ast-base.h" #include "slang-ast-decl.h" + +// #include "slang-ast-val.h.fiddle" FIDDLE() -- cgit v1.2.3