[cfe-commits] r81365 - in /cfe/trunk: include/clang/Driver/Compilation.h include/clang/Driver/Driver.h lib/Driver/Compilation.cpp lib/Driver/Driver.cpp

Daniel Dunbar daniel at zuster.org
Wed Sep 9 11:36:01 PDT 2009


Author: ddunbar
Date: Wed Sep  9 13:36:01 2009
New Revision: 81365

URL: http://llvm.org/viewvc/llvm-project?rev=81365&view=rev
Log:
Push bound architecture name into Compilation::getArgsForToolChain.

Modified:
    cfe/trunk/include/clang/Driver/Compilation.h
    cfe/trunk/include/clang/Driver/Driver.h
    cfe/trunk/lib/Driver/Compilation.cpp
    cfe/trunk/lib/Driver/Driver.cpp

Modified: cfe/trunk/include/clang/Driver/Compilation.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Compilation.h?rev=81365&r1=81364&r2=81365&view=diff

==============================================================================
--- cfe/trunk/include/clang/Driver/Compilation.h (original)
+++ cfe/trunk/include/clang/Driver/Compilation.h Wed Sep  9 13:36:01 2009
@@ -47,7 +47,8 @@
   JobList Jobs;
 
   /// Cache of translated arguments for a particular tool chain.
-  llvm::DenseMap<const ToolChain*, DerivedArgList*> TCArgs;
+  llvm::DenseMap<std::pair<const ToolChain*, const char*>,
+                 DerivedArgList*> TCArgs;
 
   /// Temporary files which should be removed on exit.
   ArgStringList TempFiles;
@@ -79,7 +80,10 @@
   /// 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.

Modified: cfe/trunk/include/clang/Driver/Driver.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Driver.h?rev=81365&r1=81364&r2=81365&view=diff

==============================================================================
--- cfe/trunk/include/clang/Driver/Driver.h (original)
+++ cfe/trunk/include/clang/Driver/Driver.h Wed Sep  9 13:36:01 2009
@@ -229,6 +229,7 @@
   void BuildJobsForAction(Compilation &C,
                           const Action *A,
                           const ToolChain *TC,
+                          const char *BoundArch,
                           bool CanAcceptPipe,
                           bool AtTopLevel,
                           const char *LinkingOutput,

Modified: cfe/trunk/lib/Driver/Compilation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Compilation.cpp?rev=81365&r1=81364&r2=81365&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/Compilation.cpp (original)
+++ cfe/trunk/lib/Driver/Compilation.cpp Wed Sep  9 13:36:01 2009
@@ -31,8 +31,9 @@
   delete Args;
 
   // Free any derived arg lists.
-  for (llvm::DenseMap<const ToolChain*, DerivedArgList*>::iterator
-         it = TCArgs.begin(), ie = TCArgs.end(); it != ie; ++it)
+  for (llvm::DenseMap<std::pair<const ToolChain*, const char*>,
+                      DerivedArgList*>::iterator it = TCArgs.begin(),
+         ie = TCArgs.end(); it != ie; ++it)
     delete it->second;
 
   // Free the actions, if built.
@@ -41,11 +42,12 @@
     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);
 

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=81365&r1=81364&r2=81365&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Wed Sep  9 13:36:01 2009
@@ -948,6 +948,7 @@
 
     InputInfo II;
     BuildJobsForAction(C, A, &C.getDefaultToolChain(),
+                       /*BoundArch*/0,
                        /*CanAcceptPipe*/ true,
                        /*AtTopLevel*/ true,
                        /*LinkingOutput*/ LinkingOutput,
@@ -1001,6 +1002,7 @@
 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 @@
     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 @@
   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 @@
     llvm::errs() << "], output: " << Result.getAsString() << "\n";
   } else {
     T.ConstructJob(C, *JA, *Dest, Result, InputInfos,
-                   C.getArgsForToolChain(TC), LinkingOutput);
+                   C.getArgsForToolChain(TC, BoundArch), LinkingOutput);
   }
 }
 





More information about the cfe-commits mailing list