From 714b0881974965e8fcfbc57b452ef648290d14a1 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Fri, 21 Jun 2019 17:39:32 -0400 Subject: 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. --- source/core/windows/slang-win-visual-studio-util.cpp | 4 +++- source/core/windows/slang-win-visual-studio-util.h | 5 +---- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'source/core/windows') diff --git a/source/core/windows/slang-win-visual-studio-util.cpp b/source/core/windows/slang-win-visual-studio-util.cpp index 81d77c710..7e683ee55 100644 --- a/source/core/windows/slang-win-visual-studio-util.cpp +++ b/source/core/windows/slang-win-visual-studio-util.cpp @@ -4,6 +4,8 @@ #include "../slang-process-util.h" #include "../slang-string-util.h" +#include "../slang-visual-studio-compiler-util.h" + #ifdef _WIN32 # define WIN32_LEAN_AND_MEAN # define NOMINMAX @@ -291,7 +293,7 @@ static SlangResult _find(int versionIndex, WinVisualStudioUtil::VersionPath& out CommandLine cmdLine; calcExecuteCompilerArgs(versionPath, cmdLine); - RefPtr compiler = new GenericCPPCompiler(desc, cmdLine, &CPPCompilerUtil::calcVisualStudioArgs); + RefPtr compiler = new GenericCPPCompiler(desc, cmdLine, &VisualStudioCompilerUtil::calcArgs, &VisualStudioCompilerUtil::parseOutput); set->addCompiler(compiler); } } diff --git a/source/core/windows/slang-win-visual-studio-util.h b/source/core/windows/slang-win-visual-studio-util.h index 76e1cc710..34be8473d 100644 --- a/source/core/windows/slang-win-visual-studio-util.h +++ b/source/core/windows/slang-win-visual-studio-util.h @@ -51,14 +51,11 @@ struct WinVisualStudioUtil /// Convert a version number into a string static void append(Version version, StringBuilder& outBuilder); - /// Calculate the command line args - static void calcArgs(const CPPCompiler::CompileOptions& options, CommandLine& cmdLine); - /// Get version as desc static CPPCompiler::Desc getDesc(Version version) { CPPCompiler::Desc desc; - desc.type = CPPCompiler::Type::VisualStudio; + desc.type = CPPCompiler::CompilerType::VisualStudio; desc.majorVersion = Int(version) / 10; desc.minorVersion = Int(version) % 10; return desc; -- cgit v1.2.3