Allow CompilerInvocations to generate .d files.
Summary: Most clang tools should ignore the -M family of options because one wouldn't want them to generate a new dependency (.d) file. However, some tools may want this dependency file. This patch creates a mechanism for them to do this. This implementation just plumbs a boolean down several layers of calls. Each of the modified calls has several call sites, and so a single member variable or new API entry point won't work. An alternative would be to write a function to filter the -M family of arguments out of CC1Args, and have each caller call that function by hand before calling newInvocation, Invocation::run, or buildAstFromCodeWithArgs. This is a more complicated and error-prone solution. Why burden all the callers to remember to use this function? But I could rewrite this patch to use that method if that is deemed more appropriate. Reviewers: klimek Reviewed By: klimek Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D34304 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307315 91177308-0d34-0410-b5e6-96231b3b80d8
Showing
- include/clang/Tooling/ArgumentsAdjusters.h 4 additions, 0 deletionsinclude/clang/Tooling/ArgumentsAdjusters.h
- include/clang/Tooling/Tooling.h 4 additions, 1 deletioninclude/clang/Tooling/Tooling.h
- lib/Tooling/ArgumentsAdjusters.cpp 21 additions, 2 deletionslib/Tooling/ArgumentsAdjusters.cpp
- lib/Tooling/Tooling.cpp 6 additions, 4 deletionslib/Tooling/Tooling.cpp
Please register or sign in to comment