diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2019-01-21 16:41:54 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-21 16:41:54 -0500 |
| commit | bd815f02d846a50e16dab67e6512db2a6215c41f (patch) | |
| tree | 01e391757bdb8f2d15bdc010227d522bddac3936 /source/slang/compiler.cpp | |
| parent | 0a3ef7b4ae02983ea3f986ba8211e7c6af9d254b (diff) | |
Feature/file unique identity (#789)
* * Fix memory bug around expanding va_args - needed buffer to have space for terminating 0
* Fix problem with FileWriter defaults being globals, as memory they allocate, will only be freed after return from main - work around by making StdWriters RefObject derived, and kept in scope such the writers are destroyed before checks for leaks is found
* Added SimplifyPathAndHash mode for CacheFileSystem - will simplify the path and see if simplified path is in cache before reading file (limiting amout of underlying file requests)
* * Added calcReplaceChar
* Renamed DefaultFileSystem to OSFileSystem
* Made OSFileSystem convert windows \ to / on linux
* Simplified logic for caching in CacheFileSystem.
* Added pragma-once-c to add extra test, but also so there is an 'include' directory in preprocessor tests.
* Small fixes in pragma once test.
* Simplified cache handling path, so that paths/simplified paths area always added.
* Improve naming of methods for different caches.
* Removed references to 'canonicalPath' and made 'uniqueIdentity'
* * Re-add support for canonicalPath to ISlangFileSystem -> not for uniqueIdentifier but as a way to display 'canonicalPath'
* Added peliminary support for being able to display verbose paths in a diagnostic
* Added 'clearCache' support
* Added verbose path support to SourceManager (now needs a ISlangFileSystemExt to do this)
* Added support for '-verbose-path' option to slangc and slang-test.
Diffstat (limited to 'source/slang/compiler.cpp')
| -rw-r--r-- | source/slang/compiler.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/source/slang/compiler.cpp b/source/slang/compiler.cpp index a003cf33d..29f7a95d9 100644 --- a/source/slang/compiler.cpp +++ b/source/slang/compiler.cpp @@ -473,6 +473,18 @@ namespace Slang sink->diagnoseRaw(SLANG_FAILED(res) ? Severity::Error : Severity::Warning, builder.getUnownedSlice()); } + static String _getDisplayPath(const DiagnosticSink& sink, SourceFile* sourceFile) + { + if (sink.flags & DiagnosticSink::Flag::VerbosePath) + { + return sourceFile->calcVerbosePath(); + } + else + { + return sourceFile->getPathInfo().foundPath; + } + } + String calcTranslationUnitSourcePath(TranslationUnitRequest* translationUnitRequest) { CompileRequest* compileRequest = translationUnitRequest->compileRequest; @@ -481,6 +493,8 @@ namespace Slang return "slang-generated"; } + auto& sink = translationUnitRequest->compileRequest->mSink; + const auto& sourceFiles = translationUnitRequest->sourceFiles; const int numSourceFiles = int(sourceFiles.Count()); @@ -488,16 +502,15 @@ namespace Slang switch (numSourceFiles) { case 0: return "unknown"; - case 1: return sourceFiles[0]->getPathInfo().foundPath; + case 1: return _getDisplayPath(sink, sourceFiles[0]); default: { StringBuilder builder; - builder << sourceFiles[0]->getPathInfo().foundPath; + builder << _getDisplayPath(sink, sourceFiles[0]); for (int i = 1; i < numSourceFiles; ++i) { - builder << ";" << sourceFiles[i]->getPathInfo().foundPath; + builder << ";" << _getDisplayPath(sink, sourceFiles[i]); } - return builder; } } |
