summaryrefslogtreecommitdiff
path: root/source/slang/slang-options.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2020-11-11 09:56:50 -0500
committerGitHub <noreply@github.com>2020-11-11 09:56:50 -0500
commit8f0895e0f8257da2fd10b6325931627a9a1792ba (patch)
tree448c221583fe160df70a2e90fd2c8b80b82634b6 /source/slang/slang-options.cpp
parent7bcc2b15c8be4aebc6b9b8f05af6db7a451b228b (diff)
Include hierarchy output (#1595)
* #include an absolute path didn't work - because paths were taken to always be relative. * Improve diagnostic for token pasting. * Token paste location test. * Output include hierarchy. * WIP on includes hierarchy. * Improved include hierarchy output - to handle source files without tokens. Improved test case. * Small comment improvements. Fixed a typo with not returning a reference. * Slight simplification of the ViewInitiatingHierarchy, by adding GetOrAddValue to Dictionary. * Remove the need for ViewInitiatingHierarchy type. * Improve output of path in diagnostic for includes hierarchy. * Remove comment in diagnostic for token-paste-location.slang * Update command line docs to include `-output-includes` Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'source/slang/slang-options.cpp')
-rw-r--r--source/slang/slang-options.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/source/slang/slang-options.cpp b/source/slang/slang-options.cpp
index db56e8115..8897a6549 100644
--- a/source/slang/slang-options.cpp
+++ b/source/slang/slang-options.cpp
@@ -441,7 +441,7 @@ struct OptionsParser
char const* arg = *argCursor++;
if (arg[0] == '-')
{
- String argStr = String(arg);
+ UnownedStringSlice argStr = UnownedStringSlice(arg);
if(argStr == "-no-mangle" )
{
@@ -461,6 +461,10 @@ struct OptionsParser
SLANG_RETURN_ON_FAIL(tryReadCommandLineArgument(sink, arg, &argCursor, argEnd, prefix));
requestImpl->getBackEndReq()->m_dumpIntermediatePrefix = prefix;
}
+ else if (argStr == "-output-includes")
+ {
+ requestImpl->getFrontEndReq()->outputIncludes = true;
+ }
else if(argStr == "-dump-ir" )
{
requestImpl->getFrontEndReq()->shouldDumpIR = true;
@@ -972,9 +976,10 @@ struct OptionsParser
String name;
SLANG_RETURN_ON_FAIL(tryReadCommandLineArgument(sink, arg, &argCursor, argEnd, name));
- String slice = argStr.subString(1, index - 1);
+ // Skip the initial -, up to the last -
+ UnownedStringSlice passThruSlice(argStr.begin() + 1, argStr.begin() + index);
SlangPassThrough passThrough = SLANG_PASS_THROUGH_NONE;
- if (SLANG_SUCCEEDED(TypeTextUtil::findPassThrough(slice.getUnownedSlice(), passThrough)))
+ if (SLANG_SUCCEEDED(TypeTextUtil::findPassThrough(passThruSlice, passThrough)))
{
session->setDownstreamCompilerPath(passThrough, name.getBuffer());
continue;