summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/Driver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Driver/Driver.cpp')
-rw-r--r--clang/lib/Driver/Driver.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index c1173e3ddbf..9139915761d 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -3689,16 +3689,27 @@ void Driver::BuildJobs(Compilation &C) const {
Arg *FinalOutput = C.getArgs().getLastArg(options::OPT_o);
// It is an error to provide a -o option if we are making multiple output
- // files. There is one exception, IfsMergeJob: when generating interface stubs
- // enabled we want to be able to generate the stub file at the same time that
- // we generate the real library/a.out. So when a .o, .so, etc are the output,
- // with clang interface stubs there will also be a .ifs and .ifso at the same
- // location.
+ // files. There are exceptions:
+ //
+ // IfsMergeJob: when generating interface stubs enabled we want to be able to
+ // generate the stub file at the same time that we generate the real
+ // library/a.out. So when a .o, .so, etc are the output, with clang interface
+ // stubs there will also be a .ifs and .ifso at the same location.
+ //
+ // CompileJob of type TY_IFS_CPP: when generating interface stubs is enabled
+ // and -c is passed, we still want to be able to generate a .ifs file while
+ // we are also generating .o files. So we allow more than one output file in
+ // this case as well.
+ //
if (FinalOutput) {
unsigned NumOutputs = 0;
+ unsigned NumIfsOutputs = 0;
for (const Action *A : C.getActions())
if (A->getType() != types::TY_Nothing &&
!(A->getKind() == Action::IfsMergeJobClass ||
+ (A->getType() == clang::driver::types::TY_IFS_CPP &&
+ A->getKind() == clang::driver::Action::CompileJobClass &&
+ 0 == NumIfsOutputs++) ||
(A->getKind() == Action::BindArchClass && A->getInputs().size() &&
A->getInputs().front()->getKind() == Action::IfsMergeJobClass)))
++NumOutputs;
OpenPOWER on IntegriCloud