diff options
author | Serge Pavlov <sepavloff@gmail.com> | 2020-04-24 12:48:39 +0700 |
---|---|---|
committer | Serge Pavlov <sepavloff@gmail.com> | 2020-11-05 12:21:40 +0700 |
commit | 20b4f4f76030f8712824c91b5f0b0a611476f747 (patch) | |
tree | e6c2826f8f6f6a246bfdf5a144c25219cd2ec4ef /clang/lib/Driver/Compilation.cpp | |
parent | ab7ef35d3460762165be8b22eb2a07a808f8f828 (diff) | |
download | llvm-20b4f4f76030f8712824c91b5f0b0a611476f747.zip llvm-20b4f4f76030f8712824c91b5f0b0a611476f747.tar.gz llvm-20b4f4f76030f8712824c91b5f0b0a611476f747.tar.bz2 |
[Driver] Add callback to Command execution
Summary:
Object of type `Compilation` now can keep a callback that is called
after each execution of `Command`. This must simplify adaptation of
clang in custom distributions and allow facilities like collection of
execution statistics.
Reviewers: rsmith, rjmccall, Eugene.Zelenko
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D78899
Diffstat (limited to 'clang/lib/Driver/Compilation.cpp')
-rw-r--r-- | clang/lib/Driver/Compilation.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/Driver/Compilation.cpp b/clang/lib/Driver/Compilation.cpp index 05ee509..d330557 100644 --- a/clang/lib/Driver/Compilation.cpp +++ b/clang/lib/Driver/Compilation.cpp @@ -193,6 +193,8 @@ int Compilation::ExecuteCommand(const Command &C, std::string Error; bool ExecutionFailed; int Res = C.Execute(Redirects, &Error, &ExecutionFailed); + if (PostCallback) + PostCallback(C, Res); if (!Error.empty()) { assert(Res && "Error string set with 0 result code!"); getDriver().Diag(diag::err_drv_command_failure) << Error; |