summaryrefslogtreecommitdiff
path: root/source/core/slang-string-util.h
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-06-21 17:39:32 -0400
committerGitHub <noreply@github.com>2019-06-21 17:39:32 -0400
commit714b0881974965e8fcfbc57b452ef648290d14a1 (patch)
treef283fb216113a9517686acf49ca436512500b4cb /source/core/slang-string-util.h
parent64eec046f5a77ebad9564a935c4fad8df08ea6eb (diff)
Parsing CPP Compiler output (#994)
* Added extractLine line parsing to StringUtil. Use for matching lines instead of calcLines. calcLines uses extractLine to extract lines. Fixed problems found in output of some tests- due to how a how final line is handled. Now a final line has a \r or \n\r combination, but nothing else after it, it is considered the last line (not the line after it). * Use StringUtil::extractLine in slang-generate. * Improved comment on extractLine * Remove test code from StringUtil::extractLine * Made StringUtil::extractLine act as if line terminators are 'separators'. Added unit-test-string.cpp - to check behavior. * Adding LineParser - not entirely necessary, but slightly easier to use. * Hack to output start of tests. * WIP parsing CPPCompiler output. * Make extractLine return a bool. * First attempt at Visual Studio output parsing. * Add handling for checking error returning from CPPCompiler. * First pass parsing output of Gcc/Clang. * Split out VisualStudioCompilerUtil and GCCCompilerUtil. Simplified parsing of versions. * Simplify CPPCompiler::Output interface. * Fix problem with cpp-compiler on linux targets. * Add shared library link error. * Improving GCC/Clang parsing output. * Make cpp compiler parsing function able to return a SlangResult. * Handling for 'info' on clang * Add expected result for c-compile-shared-library-error.c * * Add flags such that link errors on shared libraries are supported. * Added StringUtil::join * Turn off the link shared library unfound symbol option on MacOS because it causes an error (and it's not needed on that target). * Add natvis inclusion back to visual studio projects. * Display message to try and determine crash problem on travisbuild. * Fix bug in handling continuations for clang. Disabled output of exception text. * WIP: See what clang is outputting that is parsing incorrectly on travis. * More handling for travis clang parsing issue. * Restore natvis to core.vcxproj * Fix visual studio project such that it still as natvis.
Diffstat (limited to 'source/core/slang-string-util.h')
-rw-r--r--source/core/slang-string-util.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/core/slang-string-util.h b/source/core/slang-string-util.h
index 74ec75dc6..77b7ca2a3 100644
--- a/source/core/slang-string-util.h
+++ b/source/core/slang-string-util.h
@@ -41,6 +41,13 @@ struct StringUtil
/// Slices contents will directly address into in, so contents will only stay valid as long as in does.
static void split(const UnownedStringSlice& in, char splitChar, List<UnownedStringSlice>& slicesOut);
+ /// Append the joining of in items, separated by 'separator' onto out
+ static void join(const List<String>& in, char separator, StringBuilder& out);
+ static void join(const List<String>& in, const UnownedStringSlice& separator, StringBuilder& out);
+
+ static void join(const UnownedStringSlice* values, Index valueCount, char separator, StringBuilder& out);
+ static void join(const UnownedStringSlice* values, Index valueCount, const UnownedStringSlice& separator, StringBuilder& out);
+
/// Equivalent to doing a split and then finding the index of 'find' on the array
/// Returns -1 if not found
static int indexOfInSplit(const UnownedStringSlice& in, char splitChar, const UnownedStringSlice& find);
@@ -94,6 +101,9 @@ struct StringUtil
/// Equal if the lines are equal (in effect a way to ignore differences in line breaks)
static bool areLinesEqual(const UnownedStringSlice& a, const UnownedStringSlice& b);
+
+ /// Convert in to int. Returns SLANG_FAIL on error
+ static SlangResult parseInt(const UnownedStringSlice& in, Int& outValue);
};
/* A helper class that allows parsing of lines from text with iteration. Uses StringUtil::extractLine for the actual underlying implementation. */