diff --git a/clang/include/clang/Driver/Compilation.h b/clang/include/clang/Driver/Compilation.h index 9e026b91ef56..56786a7ae2a3 100644 --- a/clang/include/clang/Driver/Compilation.h +++ b/clang/include/clang/Driver/Compilation.h @@ -47,7 +47,8 @@ class Compilation { JobList Jobs; /// Cache of translated arguments for a particular tool chain. - llvm::DenseMap TCArgs; + llvm::DenseMap, + DerivedArgList*> TCArgs; /// Temporary files which should be removed on exit. ArgStringList TempFiles; @@ -79,7 +80,10 @@ public: /// getArgsForToolChain - Return the derived argument list for the /// tool chain \arg TC (or the default tool chain, if TC is not /// specified). - const DerivedArgList &getArgsForToolChain(const ToolChain *TC = 0); + /// + /// \param BoundArch - The bound architecture name, or 0. + const DerivedArgList &getArgsForToolChain(const ToolChain *TC, + const char *BoundArch); /// addTempFile - Add a file to remove on exit, and returns its /// argument. diff --git a/clang/include/clang/Driver/Driver.h b/clang/include/clang/Driver/Driver.h index c18d9e0c460b..d05d319a50a9 100644 --- a/clang/include/clang/Driver/Driver.h +++ b/clang/include/clang/Driver/Driver.h @@ -229,6 +229,7 @@ public: void BuildJobsForAction(Compilation &C, const Action *A, const ToolChain *TC, + const char *BoundArch, bool CanAcceptPipe, bool AtTopLevel, const char *LinkingOutput, diff --git a/clang/lib/Driver/Compilation.cpp b/clang/lib/Driver/Compilation.cpp index ad3cb8dbe1e6..f6e1885643ab 100644 --- a/clang/lib/Driver/Compilation.cpp +++ b/clang/lib/Driver/Compilation.cpp @@ -31,8 +31,9 @@ Compilation::~Compilation() { delete Args; // Free any derived arg lists. - for (llvm::DenseMap::iterator - it = TCArgs.begin(), ie = TCArgs.end(); it != ie; ++it) + for (llvm::DenseMap, + DerivedArgList*>::iterator it = TCArgs.begin(), + ie = TCArgs.end(); it != ie; ++it) delete it->second; // Free the actions, if built. @@ -41,11 +42,12 @@ Compilation::~Compilation() { delete *it; } -const DerivedArgList &Compilation::getArgsForToolChain(const ToolChain *TC) { +const DerivedArgList &Compilation::getArgsForToolChain(const ToolChain *TC, + const char *BoundArch) { if (!TC) TC = &DefaultToolChain; - DerivedArgList *&Entry = TCArgs[TC]; + DerivedArgList *&Entry = TCArgs[std::make_pair(TC, BoundArch)]; if (!Entry) Entry = TC->TranslateArgs(*Args); diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 24f462f18fc4..7a0527d2f17d 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -948,6 +948,7 @@ void Driver::BuildJobs(Compilation &C) const { InputInfo II; BuildJobsForAction(C, A, &C.getDefaultToolChain(), + /*BoundArch*/0, /*CanAcceptPipe*/ true, /*AtTopLevel*/ true, /*LinkingOutput*/ LinkingOutput, @@ -1001,6 +1002,7 @@ void Driver::BuildJobs(Compilation &C) const { void Driver::BuildJobsForAction(Compilation &C, const Action *A, const ToolChain *TC, + const char *BoundArch, bool CanAcceptPipe, bool AtTopLevel, const char *LinkingOutput, @@ -1032,8 +1034,8 @@ void Driver::BuildJobsForAction(Compilation &C, if (BAA->getArchName()) TC = Host->CreateToolChain(C.getArgs(), BAA->getArchName()); - BuildJobsForAction(C, *BAA->begin(), TC, CanAcceptPipe, AtTopLevel, - LinkingOutput, Result); + BuildJobsForAction(C, *BAA->begin(), TC, BAA->getArchName(), + CanAcceptPipe, AtTopLevel, LinkingOutput, Result); return; } @@ -1061,10 +1063,8 @@ void Driver::BuildJobsForAction(Compilation &C, for (ActionList::const_iterator it = Inputs->begin(), ie = Inputs->end(); it != ie; ++it) { InputInfo II; - BuildJobsForAction(C, *it, TC, TryToUsePipeInput, - /*AtTopLevel*/false, - LinkingOutput, - II); + BuildJobsForAction(C, *it, TC, BoundArch, TryToUsePipeInput, + /*AtTopLevel*/false, LinkingOutput, II); InputInfos.push_back(II); } @@ -1125,7 +1125,7 @@ void Driver::BuildJobsForAction(Compilation &C, llvm::errs() << "], output: " << Result.getAsString() << "\n"; } else { T.ConstructJob(C, *JA, *Dest, Result, InputInfos, - C.getArgsForToolChain(TC), LinkingOutput); + C.getArgsForToolChain(TC, BoundArch), LinkingOutput); } }