diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-04-06 17:07:49 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-04-06 17:07:49 +0000 |
commit | 60a53f24b160724de0e8dd0e142009981540fd26 (patch) | |
tree | bf1622e023c6493be66d690b06e3c667a53115d0 | |
parent | 13438f9b9c8fdf08998c843dd307d2a9eda05b32 (diff) |
Driver: Add a Tool::hasGoodDiagnostics hook, and use it to simplify logic for
deciding when we need to emit an extra "command failed" diagnostic.
- This also fixes the case where we were emitting that extra diagnostics, even
when using clang w/ the integrated assembler, which has good diagnostics.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100529 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/Driver/Tool.h | 4 | ||||
-rw-r--r-- | lib/Driver/Driver.cpp | 6 | ||||
-rw-r--r-- | lib/Driver/Tools.h | 5 |
3 files changed, 10 insertions, 5 deletions
diff --git a/include/clang/Driver/Tool.h b/include/clang/Driver/Tool.h index 851e4235b0..ef77206c65 100644 --- a/include/clang/Driver/Tool.h +++ b/include/clang/Driver/Tool.h @@ -48,6 +48,10 @@ public: virtual bool hasIntegratedAssembler() const { return false; } virtual bool hasIntegratedCPP() const = 0; + /// \brief Does this tool have "good" standardized diagnostics, or should the + /// driver add an additional "command failed" diagnostic on failures. + virtual bool hasGoodDiagnostics() const { return false; } + /// ConstructJob - Construct jobs to perform the action \arg JA, /// writing to \arg Output and with \arg Inputs. /// diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index 921147f7a0..7371a930c3 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -239,12 +239,8 @@ int Driver::ExecuteCompilation(const Compilation &C) const { // other tools are less common, and they generally have worse diagnostics, // so always print the diagnostic there. const Action &Source = FailingCommand->getSource(); - bool IsFriendlyTool = (isa<PreprocessJobAction>(Source) || - isa<PrecompileJobAction>(Source) || - isa<AnalyzeJobAction>(Source) || - isa<CompileJobAction>(Source)); - if (!IsFriendlyTool || Res != 1) { + if (!FailingCommand->getCreator().hasGoodDiagnostics() || Res != 1) { // FIXME: See FIXME above regarding result code interpretation. if (Res < 0) Diag(clang::diag::err_drv_command_signalled) diff --git a/lib/Driver/Tools.h b/lib/Driver/Tools.h index 7a8f1b7cb7..091fec3806 100644 --- a/lib/Driver/Tools.h +++ b/lib/Driver/Tools.h @@ -42,6 +42,7 @@ namespace tools { virtual bool acceptsPipedInput() const { return true; } virtual bool canPipeOutput() const { return true; } + virtual bool hasGoodDiagnostics() const { return true; } virtual bool hasIntegratedAssembler() const { return true; } virtual bool hasIntegratedCPP() const { return true; } @@ -79,6 +80,7 @@ namespace gcc { virtual bool acceptsPipedInput() const { return true; } virtual bool canPipeOutput() const { return true; } + virtual bool hasGoodDiagnostics() const { return true; } virtual bool hasIntegratedCPP() const { return false; } virtual void RenderExtraToolArgs(const JobAction &JA, @@ -91,6 +93,7 @@ namespace gcc { virtual bool acceptsPipedInput() const { return true; } virtual bool canPipeOutput() const { return false; } + virtual bool hasGoodDiagnostics() const { return true; } virtual bool hasIntegratedCPP() const { return true; } virtual void RenderExtraToolArgs(const JobAction &JA, @@ -103,6 +106,7 @@ namespace gcc { virtual bool acceptsPipedInput() const { return true; } virtual bool canPipeOutput() const { return true; } + virtual bool hasGoodDiagnostics() const { return true; } virtual bool hasIntegratedCPP() const { return true; } virtual void RenderExtraToolArgs(const JobAction &JA, @@ -176,6 +180,7 @@ namespace darwin { virtual bool acceptsPipedInput() const { return true; } virtual bool canPipeOutput() const { return true; } + virtual bool hasGoodDiagnostics() const { return true; } virtual bool hasIntegratedCPP() const { return true; } }; |