summaryrefslogtreecommitdiff
path: root/source/slang/compiler.h
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-01-16 13:31:42 -0500
committerGitHub <noreply@github.com>2019-01-16 13:31:42 -0500
commit86e11e0e111fab60b9517056ac049bfac6e3bd25 (patch)
treef34a8343fb6a949235f1973dc873814f408987ef /source/slang/compiler.h
parentc260e6aa3a7dc3e6794442daacde3ae23f029e0b (diff)
Feature/external compiler reporting (#776)
* Added support for converting SlangResult to string in PlatformUtil. * * Added reportExternalCompilerError * Made external compilers use this * Made DiagnosticSink accept UnownedStringSlice * Made emitXXX compiler functions return SlangError * Use smart pointers to handle life of Com interfaces * * Make SlangResult compatible with HRESULT for some common cases. * Make PlatformUtil::appendResult return SlangResult * Compile check SLANG_RESULT. * Add tests for checking diagnostics from external compilers. * * Make external compiler tests only run on windows for now. * Added 'windows' and 'unix' categories * Added categories based on what backends are available. Will make more tests run on linux and handle case where dxcompiler is not available on appveyor. * * Added spSessionCheckPassThroughSupport * Use to determine whats available for categories for tests * Add support for outputting source filename/s when using pass through.
Diffstat (limited to 'source/slang/compiler.h')
-rw-r--r--source/slang/compiler.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/source/slang/compiler.h b/source/slang/compiler.h
index 2c5d217e6..1cfb9201d 100644
--- a/source/slang/compiler.h
+++ b/source/slang/compiler.h
@@ -528,8 +528,24 @@ namespace Slang
char const* text,
CodeGenTarget target);
- /* Returns true if a codeGen target is available. */
+ /* Returns SLANG_OK if a codeGen target is available. */
SlangResult checkCompileTargetSupport(Session* session, CodeGenTarget target);
+ /* Returns SLANG_OK if pass through support is available */
+ SlangResult checkExternalCompilerSupport(Session* session, PassThroughMode passThrough);
+
+ /* Report an error appearing from external compiler to the diagnostic sink error to the diagnostic sink.
+ @param compilerName The name of the compiler the error came for (or nullptr if not known)
+ @param res Result associated with the error. The error code will be reported. (Can take HRESULT - and will expand to string if known)
+ @param diagnostic The diagnostic string associated with the compile failure
+ @param sink The diagnostic sink to report to */
+ void reportExternalCompileError(const char* compilerName, SlangResult res, const UnownedStringSlice& diagnostic, DiagnosticSink* sink);
+
+ /* Given a translationUnitRequest determines a filename that is most suitable to identify the input.
+ If the translation is a pass through will attempt to get the source file pathname. If the source is slang generated
+ there is no equivalent name so will return 'slang-generated'
+ @param translationUnitRequest The request to find an appropriate source path for
+ @return the appropriate source filename */
+ String calcTranslationUnitSourcePath(TranslationUnitRequest* translationUnitRequest);
struct TypeCheckingCache;
//