summaryrefslogtreecommitdiffstats
path: root/source/slang/compiler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/compiler.cpp')
-rw-r--r--source/slang/compiler.cpp26
1 files changed, 19 insertions, 7 deletions
diff --git a/source/slang/compiler.cpp b/source/slang/compiler.cpp
index 3155bb75a..7df978707 100644
--- a/source/slang/compiler.cpp
+++ b/source/slang/compiler.cpp
@@ -565,13 +565,31 @@ namespace Slang
void generateOutput(
CompileRequest* compileRequest)
{
- // Allow for an "extra" target to verride things first.
+ // Start of with per-translation-unit and per-entry-point lowering
+ for( auto translationUnit : compileRequest->translationUnits )
+ {
+ CompileResult translationUnitResult = emitTranslationUnit(translationUnit.Ptr());
+ translationUnit->result = translationUnitResult;
+ }
+
+
+ // Allow for an "extra" target to verride things before we finish.
switch (compileRequest->extraTarget)
{
case CodeGenTarget::ReflectionJSON:
{
String reflectionJSON = emitReflectionJSON(compileRequest->layout.Ptr());
+ // Clobber existing output so we don't have to deal with it
+ for( auto translationUnit : compileRequest->translationUnits )
+ {
+ translationUnit->result = CompileResult();
+ }
+ for( auto entryPoint : compileRequest->entryPoints )
+ {
+ entryPoint->result = CompileResult();
+ }
+
// HACK(tfoley): just print it out since that is what people probably expect.
// TODO: need a way to control where output gets routed across all possible targets.
fprintf(stdout, "%s", reflectionJSON.begin());
@@ -584,12 +602,6 @@ namespace Slang
break;
}
- // For most targets, we will do things per-translation-unit
- for( auto translationUnit : compileRequest->translationUnits )
- {
- CompileResult translationUnitResult = emitTranslationUnit(translationUnit.Ptr());
- translationUnit->result = translationUnitResult;
- }
}
}