[llvm-commits] CVS: llvm/tools/llvmc/CompilerDriver.cpp CompilerDriver.h

Reid Spencer reid at x10sys.com
Sun Dec 19 10:01:08 PST 2004



Changes in directory llvm/tools/llvmc:

CompilerDriver.cpp updated: 1.22 -> 1.23
CompilerDriver.h updated: 1.15 -> 1.16
---
Log message:

For PR351: http://llvm.cs.uiuc.edu/PR351 :
* Support changes in sys::Program::ExecuteAndWait interface 

---
Diffs of the changes:  (+16 -11)

Index: llvm/tools/llvmc/CompilerDriver.cpp
diff -u llvm/tools/llvmc/CompilerDriver.cpp:1.22 llvm/tools/llvmc/CompilerDriver.cpp:1.23
--- llvm/tools/llvmc/CompilerDriver.cpp:1.22	Mon Dec 13 02:53:36 2004
+++ llvm/tools/llvmc/CompilerDriver.cpp	Sun Dec 19 12:00:56 2004
@@ -28,9 +28,9 @@
 
 void WriteAction(CompilerDriver::Action* action ) {
   std::cerr << action->program.c_str();
-  std::vector<std::string>::iterator I = action->args.begin();
+  std::vector<std::string>::const_iterator I = action->args.begin();
   while (I != action->args.end()) {
-    std::cerr << " " + *I;
+    std::cerr << " " << *I;
     ++I;
   }
   std::cerr << "\n";
@@ -38,9 +38,9 @@
 
 void DumpAction(CompilerDriver::Action* action) {
   std::cerr << "command = " << action->program.c_str();
-  std::vector<std::string>::iterator I = action->args.begin();
+  std::vector<std::string>::const_iterator I = action->args.begin();
   while (I != action->args.end()) {
-    std::cerr << " " + *I;
+    std::cerr << " " << *I;
     ++I;
   }
   std::cerr << "\n";
@@ -392,18 +392,23 @@
                           "' is not executable.");
 
       // Invoke the program
+      const char** Args = (const char**) 
+        alloca(sizeof(const char*)*action->args.size());
+      for (unsigned i = 0; i != action->args.size(); ++i) {
+        Args[i] = action->args[i].c_str();
+      }
       if (isSet(TIME_ACTIONS_FLAG)) {
         Timer timer(action->program.toString());
         timer.startTimer();
         int resultCode = 
-          sys::Program::ExecuteAndWait(action->program,action->args);
+          sys::Program::ExecuteAndWait(action->program,Args);
         timer.stopTimer();
         timer.print(timer,std::cerr);
         return resultCode == 0;
       }
       else
         return 0 == 
-          sys::Program::ExecuteAndWait(action->program, action->args);
+          sys::Program::ExecuteAndWait(action->program, Args);
     }
     return true;
   }
@@ -560,7 +565,7 @@
       /// PRE-PROCESSING / TRANSLATION / OPTIMIZATION / ASSEMBLY phases
       // for each input item
       SetVector<sys::Path> LinkageItems;
-      std::vector<std::string> LibFiles;
+      StringVector LibFiles;
       InputList::const_iterator I = InpList.begin();
       for (InputList::const_iterator I = InpList.begin(), E = InpList.end();
            I != E; ++I ) {
@@ -817,7 +822,7 @@
           link->args.push_back(I->toString());
 
         // Add in all the libraries we found.
-        for (std::vector<std::string>::const_iterator I=LibFiles.begin(),
+        for (StringVector::const_iterator I=LibFiles.begin(),
              E=LibFiles.end(); I != E; ++I )
           link->args.push_back(std::string("-l")+*I);
 


Index: llvm/tools/llvmc/CompilerDriver.h
diff -u llvm/tools/llvmc/CompilerDriver.h:1.15 llvm/tools/llvmc/CompilerDriver.h:1.16
--- llvm/tools/llvmc/CompilerDriver.h:1.15	Tue Nov 23 17:40:06 2004
+++ llvm/tools/llvmc/CompilerDriver.h	Sun Dec 19 12:00:56 2004
@@ -81,9 +81,9 @@
       /// language.
       struct Action {
         Action() : flags(0) {}
-        sys::Path program;     ///< The program to execve
-        StringVector args;     ///< Arguments to the program
-        unsigned flags;        ///< Action specific flags
+        sys::Path program; ///< The program to execve
+        StringVector args; ///< Arguments to the program
+        unsigned flags;    ///< Action specific flags
         void set(unsigned fl ) { flags |= fl; }
         void clear(unsigned fl) { flags &= (FLAGS_MASK ^ fl); }
         bool isSet(unsigned fl) { return (flags&fl) != 0; }






More information about the llvm-commits mailing list