diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2019-08-14 15:02:21 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-08-14 15:02:21 -0400 |
| commit | 27583e993aee508361fdccffc107c2f2765698ef (patch) | |
| tree | bbd567512c3c80877275af6a65c51e6308d4bf70 /source/core/slang-gcc-compiler-util.cpp | |
| parent | dc493d492d4d9c090dab410a0cb80eca490c32aa (diff) | |
CPPCompiler::OutputMessage -> CPPCompiler::Diagnostic (#1019)
* CPPCompiler::OutputMessage -> CPPCompiler::Diagnostic
* Fix problem with merge.
* Fix another small merge issue around Diagnostic.
Diffstat (limited to 'source/core/slang-gcc-compiler-util.cpp')
| -rw-r--r-- | source/core/slang-gcc-compiler-util.cpp | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/source/core/slang-gcc-compiler-util.cpp b/source/core/slang-gcc-compiler-util.cpp index b7cc85cb3..21b55e686 100644 --- a/source/core/slang-gcc-compiler-util.cpp +++ b/source/core/slang-gcc-compiler-util.cpp @@ -92,9 +92,9 @@ SlangResult GCCCompilerUtil::calcVersion(const String& exeName, CPPCompiler::Des return SLANG_FAIL; } -static SlangResult _parseErrorType(const UnownedStringSlice& in, CPPCompiler::OutputMessage::Type& outType) +static SlangResult _parseErrorType(const UnownedStringSlice& in, CPPCompiler::Diagnostic::Type& outType) { - typedef CPPCompiler::OutputMessage::Type Type; + typedef CPPCompiler::Diagnostic::Type Type; if (in == "error" || in == "fatal error") { @@ -127,10 +127,10 @@ enum class LineParseResult } // anonymous -static SlangResult _parseGCCFamilyLine(const UnownedStringSlice& line, LineParseResult& outLineParseResult, CPPCompiler::OutputMessage& outMsg) +static SlangResult _parseGCCFamilyLine(const UnownedStringSlice& line, LineParseResult& outLineParseResult, CPPCompiler::Diagnostic& outDiagnostic) { - typedef CPPCompiler::OutputMessage OutputMessage; - typedef OutputMessage::Type Type; + typedef CPPCompiler::Diagnostic Diagnostic; + typedef Diagnostic::Type Type; // Set to default case outLineParseResult = LineParseResult::Ignore; @@ -167,7 +167,7 @@ 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)*/ - outMsg.stage = OutputMessage::Stage::Compile; + outDiagnostic.stage = Diagnostic::Stage::Compile; List<UnownedStringSlice> split; StringUtil::split(line, ':', split); @@ -178,18 +178,18 @@ static SlangResult _parseGCCFamilyLine(const UnownedStringSlice& line, LineParse if (split0 == UnownedStringSlice::fromLiteral("ld")) { // We'll ignore for now - outMsg.stage = OutputMessage::Stage::Link; - outMsg.type = Type::Info; - outMsg.text = split[1].trim(); + outDiagnostic.stage = Diagnostic::Stage::Link; + outDiagnostic.type = Type::Info; + outDiagnostic.text = split[1].trim(); outLineParseResult = LineParseResult::Start; return SLANG_OK; } - if (SLANG_SUCCEEDED(_parseErrorType(split0, outMsg.type))) + if (SLANG_SUCCEEDED(_parseErrorType(split0, outDiagnostic.type))) { // Command line errors can be just contain 'error:' etc. Can be seen on apple/clang - outMsg.stage = OutputMessage::Stage::Compile; - outMsg.text = split[1].trim(); + outDiagnostic.stage = Diagnostic::Stage::Compile; + outDiagnostic.text = split[1].trim(); outLineParseResult = LineParseResult::Single; return SLANG_OK; } @@ -208,32 +208,32 @@ static SlangResult _parseGCCFamilyLine(const UnownedStringSlice& line, LineParse split0.startsWith(UnownedStringSlice::fromLiteral("Clang")) ) { // Extract the type - SLANG_RETURN_ON_FAIL(_parseErrorType(split[1].trim(), outMsg.type)); + SLANG_RETURN_ON_FAIL(_parseErrorType(split[1].trim(), outDiagnostic.type)); if (text.startsWith("linker command failed")) { - outMsg.stage = OutputMessage::Stage::Link; + outDiagnostic.stage = Diagnostic::Stage::Link; } - outMsg.text = text; + outDiagnostic.text = text; outLineParseResult = LineParseResult::Start; return SLANG_OK; } else if (split1.startsWith("(.text")) { // This is a little weak... but looks like it's a link error - outMsg.filePath = split[0]; - outMsg.type = Type::Error; - outMsg.stage = OutputMessage::Stage::Link; - outMsg.text = text; + outDiagnostic.filePath = split[0]; + outDiagnostic.type = Type::Error; + outDiagnostic.stage = Diagnostic::Stage::Link; + outDiagnostic.text = text; outLineParseResult = LineParseResult::Single; return SLANG_OK; } else if (text.startsWith("ld returned")) { - outMsg.stage = CPPCompiler::OutputMessage::Stage::Link; - SLANG_RETURN_ON_FAIL(_parseErrorType(split[1].trim(), outMsg.type)); - outMsg.text = line; + outDiagnostic.stage = CPPCompiler::Diagnostic::Stage::Link; + SLANG_RETURN_ON_FAIL(_parseErrorType(split[1].trim(), outDiagnostic.type)); + outDiagnostic.text = line; outLineParseResult = LineParseResult::Single; return SLANG_OK; } @@ -257,11 +257,11 @@ static SlangResult _parseGCCFamilyLine(const UnownedStringSlice& line, LineParse } else { - outMsg.filePath = split[1]; - outMsg.fileLine = 0; - outMsg.type = OutputMessage::Type::Error; - outMsg.stage = OutputMessage::Stage::Link; - outMsg.text = split[3]; + outDiagnostic.filePath = split[1]; + outDiagnostic.fileLine = 0; + outDiagnostic.type = Diagnostic::Type::Error; + outDiagnostic.stage = Diagnostic::Stage::Link; + outDiagnostic.text = split[3]; outLineParseResult = LineParseResult::Start; return SLANG_OK; @@ -270,11 +270,11 @@ static SlangResult _parseGCCFamilyLine(const UnownedStringSlice& line, LineParse else if (split.getCount() == 5) { // Probably a regular error line - SLANG_RETURN_ON_FAIL(_parseErrorType(split[3].trim(), outMsg.type)); + SLANG_RETURN_ON_FAIL(_parseErrorType(split[3].trim(), outDiagnostic.type)); - outMsg.filePath = split[0]; - SLANG_RETURN_ON_FAIL(StringUtil::parseInt(split[1], outMsg.fileLine)); - outMsg.text = split[4]; + outDiagnostic.filePath = split[0]; + SLANG_RETURN_ON_FAIL(StringUtil::parseInt(split[1], outDiagnostic.fileLine)); + outDiagnostic.text = split[4]; outLineParseResult = LineParseResult::Start; return SLANG_OK; @@ -290,30 +290,30 @@ static SlangResult _parseGCCFamilyLine(const UnownedStringSlice& line, LineParse LineParseResult prevLineResult = LineParseResult::Ignore; outOutput.reset(); - outOutput.rawMessages = exeRes.standardError; + outOutput.rawDiagnostics = exeRes.standardError; for (auto line : LineParser(exeRes.standardError.getUnownedSlice())) { - CPPCompiler::OutputMessage msg; - msg.reset(); + CPPCompiler::Diagnostic diagnostic; + diagnostic.reset(); LineParseResult lineRes; - SLANG_RETURN_ON_FAIL(_parseGCCFamilyLine(line, lineRes, msg)); + SLANG_RETURN_ON_FAIL(_parseGCCFamilyLine(line, lineRes, diagnostic)); switch (lineRes) { case LineParseResult::Start: { // It's start of a new message - outOutput.messages.add(msg); + outOutput.diagnostics.add(diagnostic); prevLineResult = LineParseResult::Start; break; } case LineParseResult::Single: { // It's a single message, without anything following - outOutput.messages.add(msg); + outOutput.diagnostics.add(diagnostic); prevLineResult = LineParseResult::Ignore; break; } @@ -321,10 +321,10 @@ static SlangResult _parseGCCFamilyLine(const UnownedStringSlice& line, LineParse { if (prevLineResult == LineParseResult::Start || prevLineResult == LineParseResult::Continuation) { - if (outOutput.messages.getCount() > 0) + if (outOutput.diagnostics.getCount() > 0) { // We are now in a continuation, add to the last - auto& text = outOutput.messages.getLast().text; + auto& text = outOutput.diagnostics.getLast().text; text.append("\n"); text.append(line); } @@ -341,7 +341,7 @@ static SlangResult _parseGCCFamilyLine(const UnownedStringSlice& line, LineParse } } - if (outOutput.has(CPPCompiler::OutputMessage::Type::Error) || exeRes.resultCode != 0) + if (outOutput.has(CPPCompiler::Diagnostic::Type::Error) || exeRes.resultCode != 0) { outOutput.result = SLANG_FAIL; } |
