diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2019-08-15 18:38:59 -0400 |
|---|---|---|
| committer | Tim Foley <tfoleyNV@users.noreply.github.com> | 2019-08-15 15:38:59 -0700 |
| commit | 77fe3dd74446fb07dd0de31114f7033f111ef868 (patch) | |
| tree | 835044f955d4f2afc02894448864321fca3344df /source/slang/slang-options.cpp | |
| parent | 44506607215247be4bf33c1a629bf39971bc966f (diff) | |
A more convoluted #pragma once file identity test, using relative paths. (#1021)
* A more convoluted #pragma once file identity test, using relative paths.
* Fix bug with passing - to slang as a command line option causes a crash.
Ability to set file-system to use on command line.
#pragma once tests try with 'normal' and 'read-file' only versions
* OSFileSystem -> OSFileSystemExt
LoadFileOSFileSystem -> OSFileSystem
Implemented OSFileSystem like OSFileSystemExt as as singleton.
Fixes to comments.
Diffstat (limited to 'source/slang/slang-options.cpp')
| -rw-r--r-- | source/slang/slang-options.cpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/source/slang/slang-options.cpp b/source/slang/slang-options.cpp index 81fb468eb..5918f1551 100644 --- a/source/slang/slang-options.cpp +++ b/source/slang/slang-options.cpp @@ -8,6 +8,8 @@ #include "slang-compiler.h" #include "slang-profile.h" +#include "slang-file-system.h" + #include <assert.h> namespace Slang { @@ -632,7 +634,7 @@ struct OptionsParser SLANG_RETURN_ON_FAIL(tryReadCommandLineArgument(sink, arg, &argCursor, argEnd, name)); addSharedLibraryPath(SharedLibraryType::Fxc, name); } - else if (argStr[1] == 'D') + else if (argStr.getLength() >= 2 && argStr[1] == 'D') { // The value to be defined might be part of the same option, as in: // -DFOO @@ -677,7 +679,7 @@ struct OptionsParser ""); } } - else if (argStr[1] == 'I') + else if (argStr.getLength() >= 2 && argStr[1] == 'I') { // The value to be defined might be part of the same option, as in: // -IFOO @@ -803,6 +805,25 @@ struct OptionsParser { requestImpl->getBackEndReq()->useUnknownImageFormatAsDefault = true; } + else if (argStr == "-file-system") + { + String name; + SLANG_RETURN_ON_FAIL(tryReadCommandLineArgument(sink, arg, &argCursor, argEnd, name)); + + if (name == "default") + { + spSetFileSystem(compileRequest, nullptr); + } + else if (name == "load-file") + { + spSetFileSystem(compileRequest, OSFileSystem::getSingleton()); + } + else + { + sink->diagnose(SourceLoc(), Diagnostics::unknownFileSystemOption, name); + return SLANG_FAIL; + } + } else if (argStr == "--") { // The `--` option causes us to stop trying to parse options, |
