diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2020-03-31 14:06:34 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-31 14:06:34 -0400 |
| commit | 5e73e984022c9ec8e901ccffc94d3cd5f374642a (patch) | |
| tree | 47555cb09e187729336a134ccd794e5fddddbacd /source/core | |
| parent | ea7690558bca71ce3a9453adff4e0135352a352f (diff) | |
Improve diagnostic parsing from GCC. (#1303)
Enable x86_64 CPU tests on TC.
Diffstat (limited to 'source/core')
| -rw-r--r-- | source/core/slang-gcc-compiler-util.cpp | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/source/core/slang-gcc-compiler-util.cpp b/source/core/slang-gcc-compiler-util.cpp index 08e45b5c1..3f045aa80 100644 --- a/source/core/slang-gcc-compiler-util.cpp +++ b/source/core/slang-gcc-compiler-util.cpp @@ -134,7 +134,7 @@ static SlangResult _parseGCCFamilyLine(const UnownedStringSlice& line, LineParse // Set to default case outLineParseResult = LineParseResult::Ignore; - + /* example error output from different scenarios */ /* @@ -167,11 +167,29 @@ static SlangResult _parseGCCFamilyLine(const UnownedStringSlice& line, LineParse /home/travis/build/shader-slang/slang/tests/cpp-compiler/c-compile-link-error.c:10: undefined reference to `thing' clang-7: error: linker command failed with exit code 1 (use -v to see invocation)*/ + /* /path/slang-cpp-prelude.h:4:10: fatal error: ../slang.h: No such file or directory + #include "../slang.h" + ^~~~~~~~~~~~ + compilation terminated.*/ + outDiagnostic.stage = Diagnostic::Stage::Compile; List<UnownedStringSlice> split; StringUtil::split(line, ':', split); + // On windows we can have paths that are a: etc... if we detect this we can combine 0 - 1 to be 1. + if (split.getCount() > 1 && split[0].getLength() == 1) + { + const char c = split[0][0]; + if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) + { + // We'll assume it's a path + UnownedStringSlice path(split[0].begin(), split[1].end()); + split.removeAt(0); + split[0] = path; + } + } + if (split.getCount() == 2) { const auto split0 = split[0].trim(); @@ -267,19 +285,21 @@ static SlangResult _parseGCCFamilyLine(const UnownedStringSlice& line, LineParse return SLANG_OK; } } - else if (split.getCount() == 5) + else if (split.getCount() >= 5) { // Probably a regular error line SLANG_RETURN_ON_FAIL(_parseErrorType(split[3].trim(), outDiagnostic.type)); outDiagnostic.filePath = split[0]; SLANG_RETURN_ON_FAIL(StringUtil::parseInt(split[1], outDiagnostic.fileLine)); - outDiagnostic.text = split[4]; + + // Everything from 4 to the end is the error + outDiagnostic.text = UnownedStringSlice(split[4].begin(), split.getLast().end()); outLineParseResult = LineParseResult::Start; return SLANG_OK; } - + // Assume it's a continuation outLineParseResult = LineParseResult::Continuation; return SLANG_OK; |
