From 064c28f58e845be67a31283cb885b22f32118f49 Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Sun, 9 Jul 2017 18:08:22 -0700 Subject: 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. --- source/slang/compiler.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'source/slang/compiler.cpp') 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; } } } -- cgit v1.2.3