diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2020-04-16 18:25:53 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-16 15:25:53 -0700 |
| commit | 12b30afb24ac03d69f091f18c25ed2bbefae1acd (patch) | |
| tree | fd5dc0c512c707c46bd3640f604f308a461a6bda /source/core/slang-string-util.cpp | |
| parent | b5a531738baa1e856b15bb3dffdbea9a1ee5cc82 (diff) | |
Workaround for matching of dxc diagnostics (#1324)
* Specialized handling for comparison of dxc output that ignores line/column numbers.
* Simplify areAllEqualWithSplit.
Diffstat (limited to 'source/core/slang-string-util.cpp')
| -rw-r--r-- | source/core/slang-string-util.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/source/core/slang-string-util.cpp b/source/core/slang-string-util.cpp index f961e6060..326bc3191 100644 --- a/source/core/slang-string-util.cpp +++ b/source/core/slang-string-util.cpp @@ -6,6 +6,32 @@ namespace Slang { // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! StringUtil !!!!!!!!!!!!!!!!!!!!!!!!!!! +/* static */bool StringUtil::areAllEqual(const List<UnownedStringSlice>& a, const List<UnownedStringSlice>& b, EqualFn equalFn) +{ + if (a.getCount() != b.getCount()) + { + return false; + } + + const Index count = a.getCount(); + for (Index i = 0; i < count; ++i) + { + if (!equalFn(a[i], b[i])) + { + return false; + } + } + return true; +} + +/* static */bool StringUtil::areAllEqualWithSplit(const UnownedStringSlice& a, const UnownedStringSlice& b, char splitChar, EqualFn equalFn) +{ + List<UnownedStringSlice> slicesA, slicesB; + StringUtil::split(a, splitChar, slicesA); + StringUtil::split(b, splitChar, slicesB); + return areAllEqual(slicesA, slicesB, equalFn); +} + /* static */void StringUtil::split(const UnownedStringSlice& in, char splitChar, List<UnownedStringSlice>& slicesOut) { slicesOut.clear(); |
