diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-07-01 19:14:39 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-07-01 19:14:39 +0000 |
commit | 31c11ebdaab0acfa10e231730ae95e32c0e39e1f (patch) | |
tree | 800d30a94d076216f09c4a0ba1413ca65db15367 /include/clang/Driver/Compilation.h | |
parent | cae087e164e94e4286c11bf694dd0ff88f295302 (diff) |
Driver: Improve diagnostics for failed commands.
- Not all tools give good error messages, and sometimes the tool can fail w/o
any error (for example, when signalled).
- We suppress this message when the failing command is the compiler and it
failed normally (exit code == 1), under the assumption that it gave a good
diagnostic.
For example, for a linker failure we now get:
--
ddunbar@lordcrumb:tmp$ clang a.c b.c
ld: duplicate symbol _x in /var/folders/cl/clrOX6SaG+moCeRKEI4PtU+++TI/-Tmp-/cc-bXYITq.o and /var/folders/cl/clrOX6SaG+moCeRKEI4PtU+++TI/-Tmp-/cc-6uK4jD.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
--
For a compiler crash we get:
--
ddunbar@lordcrumb:tmp$ clang t.i
Assertion failed: (CGT.getTargetData().getTypeAllocSizeInBits(STy) == RL.getSize()), function layoutStructFields, file CodeGenTypes.cpp, line 573.
0 clang-cc 0x0000000100f1f1f1 PrintStackTrace(void*) + 38
... stack trace and virtual stack trace follow ...
clang: error: compiler command failed due to signal 6 (use -v to see invocation)
--
But for a regular compilation failure we get the usual:
--
ddunbar@lordcrumb:tmp$ clang c.c
c.c:1:6: error: invalid token after top level declarator
int x
^
1 diagnostic generated.
--
- No test case, not amenable to non-executable testing. :/
- <rdar://problem/6945613>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74629 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Driver/Compilation.h')
-rw-r--r-- | include/clang/Driver/Compilation.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/include/clang/Driver/Compilation.h b/include/clang/Driver/Compilation.h index 4985f30ad5..0e66796a6e 100644 --- a/include/clang/Driver/Compilation.h +++ b/include/clang/Driver/Compilation.h @@ -103,22 +103,26 @@ private: /// PrintJob - Print one job in -### format. /// - /// OS - The stream to print on. - /// J - The job to print. - /// Terminator - A string to print at the end of the line. - /// Quote - Should separate arguments be quoted. + /// \param OS - The stream to print on. + /// \param J - The job to print. + /// \param Terminator - A string to print at the end of the line. + /// \param Quote - Should separate arguments be quoted. void PrintJob(llvm::raw_ostream &OS, const Job &J, const char *Terminator, bool Quote) const; /// ExecuteCommand - Execute an actual command. /// + /// \param FailingCommand - For non-zero results, this will be set to the + /// Command which failed, if any. /// \return The result code of the subprocess. - int ExecuteCommand(const Command &C) const; + int ExecuteCommand(const Command &C, const Command *&FailingCommand) const; /// ExecuteJob - Execute a single job. /// + /// \param FailingCommand - For non-zero results, this will be set to the + /// Command which failed, if any. /// \return The accumulated result code of the job. - int ExecuteJob(const Job &J) const; + int ExecuteJob(const Job &J, const Command *&FailingCommand) const; }; } // end namespace driver |