summaryrefslogtreecommitdiffstats
path: root/source/slang/compiler.cpp
diff options
context:
space:
mode:
authorTim Foley <tfoley@nvidia.com>2017-07-09 18:08:22 -0700
committerTim Foley <tfoley@nvidia.com>2017-07-09 18:08:22 -0700
commit064c28f58e845be67a31283cb885b22f32118f49 (patch)
tree559cde481de3dc37ad0e571380367bb0a6ebc3ca /source/slang/compiler.cpp
parent54364eb1aef3fc6aa87b144ba91ca0a77818e4a4 (diff)
Pick layout rules based on target languge, not source.
The tricky bit here was that the `reflection-json` output format isn't really a code generation target like the others, and we need to be able to have multiple "targets" active to make sense of it. This needs cleaning-up.
Diffstat (limited to 'source/slang/compiler.cpp')
-rw-r--r--source/slang/compiler.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/source/slang/compiler.cpp b/source/slang/compiler.cpp
index 19623a7aa..f9c188764 100644
--- a/source/slang/compiler.cpp
+++ b/source/slang/compiler.cpp
@@ -520,17 +520,9 @@ namespace Slang
void generateOutput(
CompileRequest* compileRequest)
{
- switch (compileRequest->Target)
+ // Allow for an "extra" target to verride things first.
+ switch (compileRequest->extraTarget)
{
- default:
- // For most targets, we will do things per-translation-unit
- for( auto translationUnit : compileRequest->translationUnits )
- {
- TranslationUnitResult translationUnitResult = emitTranslationUnit(translationUnit.Ptr());
- translationUnit->result = translationUnitResult;
- }
- break;
-
case CodeGenTarget::ReflectionJSON:
{
String reflectionJSON = emitReflectionJSON(compileRequest->layout.Ptr());
@@ -538,8 +530,20 @@ namespace Slang
// 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());
+
+ return;
}
break;
+
+ default:
+ break;
+ }
+
+ // For most targets, we will do things per-translation-unit
+ for( auto translationUnit : compileRequest->translationUnits )
+ {
+ TranslationUnitResult translationUnitResult = emitTranslationUnit(translationUnit.Ptr());
+ translationUnit->result = translationUnitResult;
}
}
}