Skip to content

Commit

Permalink
format code
Browse files Browse the repository at this point in the history
  • Loading branch information
slangbot authored and tareksander committed Nov 9, 2024
1 parent 87c08ca commit 54b3a30
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 17 deletions.
3 changes: 2 additions & 1 deletion source/compiler-core/slang-pretty-writer.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "slang-pretty-writer.h"

#include "../core/slang-string-escape-util.h"

namespace Slang
Expand Down Expand Up @@ -81,4 +82,4 @@ void PrettyWriter::maybeComma()
write(toSlice(",\n"));
}

}
} // namespace Slang
4 changes: 2 additions & 2 deletions source/compiler-core/slang-pretty-writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@


#include "../core/slang-char-util.h"
#include "../core/slang-string.h"
#include "../core/slang-string-util.h"
#include "../core/slang-string.h"

namespace Slang
{
Expand Down Expand Up @@ -116,7 +116,7 @@ struct CommaTrackerRAII
PrettyWriter::CommaState* m_previousState;
};

}
} // namespace Slang


#endif
4 changes: 2 additions & 2 deletions source/slang/slang-options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ void initCommandOptions(CommandOptions& options)
"reflection-json <path>",
"Emit reflection data in JSON format to a file."},
};


_addOptions(makeConstArrayView(generalOpts), options);

Expand Down Expand Up @@ -2672,7 +2672,7 @@ SlangResult OptionsParser::_parse(int argc, char const* const* argv)
{
CommandLineArg outputPath;
SLANG_RETURN_ON_FAIL(m_reader.expectArg(outputPath));

linkage->m_optionSet.set(CompilerOptionName::EmitReflectionJSON, outputPath.value);
break;
}
Expand Down
8 changes: 6 additions & 2 deletions source/slang/slang-reflection-json.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

#include "slang-reflection-json.h"

#include "slang.h"

template<typename T>
Expand Down Expand Up @@ -1185,10 +1186,13 @@ static void emitReflectionJSON(
writer << "\n}\n";
}

void emitReflectionJSON(SlangCompileRequest* request, SlangReflection* reflection, PrettyWriter& writer)
void emitReflectionJSON(
SlangCompileRequest* request,
SlangReflection* reflection,
PrettyWriter& writer)
{
auto programReflection = (slang::ShaderReflection*)reflection;
emitReflectionJSON(writer, request, programReflection);
}

}
} // namespace Slang
7 changes: 5 additions & 2 deletions source/slang/slang-reflection-json.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
#ifndef SLANG_REFLECTION_JSON_H
#define SLANG_REFLECTION_JSON_H

#include "slang.h"
#include "../compiler-core/slang-pretty-writer.h"
#include "slang.h"

namespace Slang
{

void emitReflectionJSON(SlangCompileRequest* request, SlangReflection* reflection, PrettyWriter& writer);
void emitReflectionJSON(
SlangCompileRequest* request,
SlangReflection* reflection,
PrettyWriter& writer);

}

Expand Down
12 changes: 5 additions & 7 deletions source/slang/slang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
#include "slang-parameter-binding.h"
#include "slang-parser.h"
#include "slang-preprocessor.h"
#include "slang-reflection-json.h"
#include "slang-repro.h"
#include "slang-serialize-ast.h"
#include "slang-serialize-container.h"
#include "slang-serialize-ir.h"
#include "slang-tag-version.h"
#include "slang-type-layout.h"
#include "slang-reflection-json.h"

#include <sys/stat.h>

Expand Down Expand Up @@ -6857,7 +6857,7 @@ SlangResult EndToEndCompileRequest::compile()
}
}
}

auto reflectionPath = getOptionSet().getStringOption(CompilerOptionName::EmitReflectionJSON);
if (reflectionPath.getLength() != 0)
{
Expand All @@ -6867,12 +6867,10 @@ SlangResult EndToEndCompileRequest::compile()
{
auto builder = bufferWriter.getBuilder();
StdWriters::getOut().write(builder.getBuffer(), builder.getLength());
} else if (SLANG_FAILED(File::writeAllText(reflectionPath, bufferWriter.getBuilder())))
}
else if (SLANG_FAILED(File::writeAllText(reflectionPath, bufferWriter.getBuilder())))
{
getSink()->diagnose(
SourceLoc(),
Diagnostics::unableToWriteFile,
reflectionPath);
getSink()->diagnose(SourceLoc(), Diagnostics::unableToWriteFile, reflectionPath);
}
}

Expand Down
2 changes: 1 addition & 1 deletion tools/slang-reflection-test/slang-reflection-test-main.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// slang-reflection-test-main.cpp

#include "../../source/compiler-core/slang-pretty-writer.h"
#include "../../source/core/slang-char-util.h"
#include "../../source/core/slang-string-escape-util.h"
#include "../../source/core/slang-string-util.h"
#include "../../source/core/slang-test-tool-util.h"
#include "../../source/compiler-core/slang-pretty-writer.h"
#include "../../source/slang/slang-reflection-json.h"
#include "slang-com-helper.h"
#include "slang.h"
Expand Down

0 comments on commit 54b3a30

Please sign in to comment.