diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2022-09-28 13:30:37 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-28 13:30:37 -0400 |
| commit | dafe651ecf21f2dce7f156179af785adca08ced0 (patch) | |
| tree | 4069004abf2531c1c781dd86896a6e232840c713 /tools | |
| parent | e449446d540b6cc3d5fcd70a8f05886ef2be7547 (diff) | |
Improvements around diagnostic controls (#2414)
* #include an absolute path didn't work - because paths were taken to always be relative.
* Test for disabling warnings.
* Output diagnostic if argument parsing fails in render test.
* More improvements around disabling diagnostics.
* Add support for re enabling a warning.
* Add warning controls to help text.
* Tidy up around NameConventionUtil.
* Make NameConvention an enum.
* Handle leading underscores.
* Update comment, and remove intial handling of _ prefix.
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/render-test/slang-support.cpp | 13 | ||||
| -rw-r--r-- | tools/slang-cpp-extractor/cpp-extractor-main.cpp | 4 | ||||
| -rw-r--r-- | tools/slang-cpp-extractor/node-tree.cpp | 2 |
3 files changed, 15 insertions, 4 deletions
diff --git a/tools/render-test/slang-support.cpp b/tools/render-test/slang-support.cpp index ed7bb752e..5b2d69bf4 100644 --- a/tools/render-test/slang-support.cpp +++ b/tools/render-test/slang-support.cpp @@ -85,9 +85,20 @@ void ShaderCompilerUtil::Output::reset() args.add(arg.value.getBuffer()); } + // If there are additional args parse them if (args.getCount()) { - SLANG_RETURN_ON_FAIL(spProcessCommandLineArguments(slangRequest, args.getBuffer(), int(args.getCount()))); + const auto res = slangRequest->processCommandLineArguments(args.getBuffer(), int(args.getCount())); + + // If there is a parse failure and diagnostic, output it + if (SLANG_FAILED(res)) + { + if (auto diagnostics = slangRequest->getDiagnosticOutput()) + { + fprintf(stderr, "%s", diagnostics); + } + return res; + } } } diff --git a/tools/slang-cpp-extractor/cpp-extractor-main.cpp b/tools/slang-cpp-extractor/cpp-extractor-main.cpp index 6fbba20c3..c8a4d80f5 100644 --- a/tools/slang-cpp-extractor/cpp-extractor-main.cpp +++ b/tools/slang-cpp-extractor/cpp-extractor-main.cpp @@ -246,7 +246,7 @@ SlangResult App::execute(const Options& options) { StringBuilder buf; // Let's guess a 'fileMark' (it becomes part of the filename) based on the macro name. Use lower kabab. - NameConventionUtil::join(slices.getBuffer(), slices.getCount(), CharCase::Lower, NameConvention::Kabab, buf); + NameConventionUtil::join(slices.getBuffer(), slices.getCount(), NameConvention::LowerKabab, buf); typeSet->m_fileMark = buf.ProduceString(); } @@ -254,7 +254,7 @@ SlangResult App::execute(const Options& options) { // Let's guess a typename if not set -> go with upper camel StringBuilder buf; - NameConventionUtil::join(slices.getBuffer(), slices.getCount(), CharCase::Upper, NameConvention::Camel, buf); + NameConventionUtil::join(slices.getBuffer(), slices.getCount(), NameConvention::UpperCamel, buf); typeSet->m_typeName = buf.ProduceString(); } } diff --git a/tools/slang-cpp-extractor/node-tree.cpp b/tools/slang-cpp-extractor/node-tree.cpp index f21d912a7..546a54c27 100644 --- a/tools/slang-cpp-extractor/node-tree.cpp +++ b/tools/slang-cpp-extractor/node-tree.cpp @@ -79,7 +79,7 @@ SourceOrigin* NodeTree::addSourceOrigin(SourceFile* sourceFile, const Options& o slice = slice.trim('-'); StringBuilder out; - NameConventionUtil::convert(slice, CharCase::Upper, NameConvention::Snake, out); + NameConventionUtil::convert(slice, NameConvention::UpperSnake, out); return out; } |
