summaryrefslogtreecommitdiff
path: root/source/slang/slang-compiler.h
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2023-04-20 11:55:26 -0400
committerGitHub <noreply@github.com>2023-04-20 11:55:26 -0400
commit467fa3a5dcdd36e310b084747d6f4fcd6ca81249 (patch)
tree193104aad3da77fffddb4b9be3edad4bcfdf76ac /source/slang/slang-compiler.h
parent4d24f55226870055c8dcbb3409efc5355da134d7 (diff)
Improvements outputting containers (#2815)
* #include an absolute path didn't work - because paths were taken to always be relative. * Moved JSON source map writing logic to JSONSourceMapUtil. * Use ArtifactHandler to read/write SourceMaps. Use ObjectCastableAdapter to hold SourceMap Only serialize SourceMap <-> JSON on demand. * Make some types swappable. * BoxValue impl. * Added asBoxValue. * Remove const get funcs. * Fix typo in asBoxValue. * Fix another typo in asBoxValue. * Slightly simplify conversion to blob of SourceMap. * WIP Api improvements around sourcemap/artifact/line-directive. * Small fix for asBoxValue * WIP outputting container with multiple artifacts. * Added ArtifactContailerUtil::filter to produce an artifact hierarchy that only contains "signficant" and "blobable" artifacts. * Make emitting IR disjoint to using a container. Added -emit-ir option. Simplfiy output. * Fix typo in options parsing. * Add a test that ouputs with an emit source map. * Enable emitting our SlangIR module if no targets are specified. * Fix issues constructing container. * Extra checks getting obfuscated source map from a translation unit. * Fix typo.
Diffstat (limited to 'source/slang/slang-compiler.h')
-rwxr-xr-xsource/slang/slang-compiler.h22
1 files changed, 12 insertions, 10 deletions
diff --git a/source/slang/slang-compiler.h b/source/slang/slang-compiler.h
index 0c366f485..d0827e2e6 100755
--- a/source/slang/slang-compiler.h
+++ b/source/slang/slang-compiler.h
@@ -104,6 +104,7 @@ namespace Slang
None = SLANG_LINE_DIRECTIVE_MODE_NONE,
Standard = SLANG_LINE_DIRECTIVE_MODE_STANDARD,
GLSL = SLANG_LINE_DIRECTIVE_MODE_GLSL,
+ SourceMap = SLANG_LINE_DIRECTIVE_MODE_SOURCE_MAP,
};
enum class ResultFormat
@@ -1771,8 +1772,7 @@ namespace Slang
SourceManager* m_sourceManager = nullptr;
bool m_obfuscateCode = false;
- bool m_generateSourceMap = false;
-
+
/// Holds any args that are destined for downstream compilers/tools etc
DownstreamArgs m_downstreamArgs;
@@ -2626,6 +2626,9 @@ namespace Slang
~EndToEndCompileRequest();
+ // If enabled will emit IR
+ bool m_emitIr = false;
+
// What container format are we being asked to generate?
// If it's set to a format, the container blob will be calculated during compile
ContainerFormat m_containerFormat = ContainerFormat::None;
@@ -2650,6 +2653,7 @@ namespace Slang
// Are we being driven by the command-line `slangc`, and should act accordingly?
bool m_isCommandLineCompile = false;
+
String m_diagnosticOutput;
@@ -2769,11 +2773,12 @@ namespace Slang
String m_dumpIntermediatePrefix;
private:
- void writeWholeProgramResult(
- TargetRequest* targetReq);
- void writeEntryPointResult(
- TargetRequest* targetReq,
- Int entryPointIndex);
+
+ String _getWholeProgramPath(TargetRequest* targetReq);
+ String _getEntryPointPath(TargetRequest* targetReq, Index entryPointIndex);
+
+ /// Maybe write the artifact to the path (if set), or stdout (if there is no container or path)
+ SlangResult _maybeWriteArtifact(const String& path, IArtifact* artifact);
ISlangUnknown* getInterface(const Guid& guid);
@@ -2782,9 +2787,6 @@ namespace Slang
void init();
- SlangResult _createContainer();
- SlangResult _completeContainer();
-
Session* m_session = nullptr;
RefPtr<Linkage> m_linkage;
DiagnosticSink m_sink;