From da0d295d6c8b6fb03245dea0583437c198890349 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Thu, 22 Apr 2021 09:32:25 -0400 Subject: C++ extractor improvements (#1803) * #include an absolute path didn't work - because paths were taken to always be relative. * Split of NodeTree. Split out FileUtil. Split out MacroWriter. * Rename slang-cpp-extractor-main.cpp -> cpp-extractor-main.cpp * First pass at extractor unit-tests * Initial parsing of enum. * Ability to disable/enable parsing of scope types. * Initial support for typedef. * Added operator== != to ArrayVIew. Added test for splitting to unit tests. * Improve comment in StringUtil. * Fix comment. * Fix typo. --- tools/slang-cpp-extractor/options.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'tools/slang-cpp-extractor/options.cpp') diff --git a/tools/slang-cpp-extractor/options.cpp b/tools/slang-cpp-extractor/options.cpp index c7b6a9df5..9ec671652 100644 --- a/tools/slang-cpp-extractor/options.cpp +++ b/tools/slang-cpp-extractor/options.cpp @@ -81,8 +81,7 @@ SlangResult OptionsParser::parse(int argc, const char*const* argv, DiagnosticSin } else if (arg == "-dump") { - outOptions.m_dump = true; - m_index++; + SLANG_RETURN_ON_FAIL(_parseArgFlag("-dump", outOptions.m_dump)); continue; } else if (arg == "-mark-prefix") @@ -110,13 +109,18 @@ SlangResult OptionsParser::parse(int argc, const char*const* argv, DiagnosticSin SLANG_RETURN_ON_FAIL(_parseArgWithValue("-strip-prefix", outOptions.m_stripFilePrefix)); continue; } + else if (arg == "-unit-test") + { + SLANG_RETURN_ON_FAIL(_parseArgFlag("-unit-test", outOptions.m_runUnitTests)); + continue; + } m_sink->diagnose(SourceLoc(), CPPDiagnostics::unknownOption, arg); return SLANG_FAIL; } else { - // If it starts with - then it an unknown option + // If it doesn't start with - then it's assumed to be an input path outOptions.m_inputPaths.add(arg); m_index++; } -- cgit v1.2.3