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

Reid Spencer reid at x10sys.com
Thu Jul 7 16:22:01 PDT 2005



Changes in directory llvm/tools/llvmc:

CompilerDriver.cpp updated: 1.32 -> 1.33
Configuration.cpp updated: 1.22 -> 1.23
---
Log message:

For PR495: http://llvm.cs.uiuc.edu/PR495 :
Get rid of the difference between file paths and directory paths. The Path
class now simply stores a path that can refer to either a file or a 
directory. This required various changes in the implementation and interface
of the class with the corresponding impact to its users. Doxygen comments were
also updated to reflect these changes. Interface changes are:

appendDirectory -> appendComponent
appendFile -> appendComponent
elideDirectory -> eraseComponent
elideFile -> eraseComponent
elideSuffix -> eraseSuffix
renameFile -> rename
setDirectory -> set
setFile -> set

Changes pass Dejagnu and llvm-test/SingleSource tests.


---
Diffs of the changes:  (+24 -24)

 CompilerDriver.cpp |   30 +++++++++++++++---------------
 Configuration.cpp  |   18 +++++++++---------
 2 files changed, 24 insertions(+), 24 deletions(-)


Index: llvm/tools/llvmc/CompilerDriver.cpp
diff -u llvm/tools/llvmc/CompilerDriver.cpp:1.32 llvm/tools/llvmc/CompilerDriver.cpp:1.33
--- llvm/tools/llvmc/CompilerDriver.cpp:1.32	Thu Jul  7 13:21:42 2005
+++ llvm/tools/llvmc/CompilerDriver.cpp	Thu Jul  7 18:21:43 2005
@@ -134,7 +134,7 @@
     StringVector::const_iterator E = paths.end();
     while (I != E) {
       sys::Path tmp;
-      tmp.setDirectory(*I);
+      tmp.set(*I);
       IncludePaths.push_back(tmp);
       ++I;
     }
@@ -149,7 +149,7 @@
     StringVector::const_iterator E = paths.end();
     while (I != E) {
       sys::Path tmp;
-      tmp.setDirectory(*I);
+      tmp.set(*I);
       LibraryPaths.push_back(tmp);
       ++I;
     }
@@ -188,7 +188,7 @@
   void cleanup() {
     if (!isSet(KEEP_TEMPS_FLAG)) {
       if (TempDir.isDirectory() && TempDir.canWrite())
-        TempDir.destroyDirectory(/*remove_contents=*/true);
+        TempDir.destroy(/*remove_contents=*/true);
     } else {
       std::cout << "Temporary files are in " << TempDir << "\n";
     }
@@ -197,7 +197,7 @@
   sys::Path MakeTempFile(const std::string& basename,
                          const std::string& suffix) {
     sys::Path result(TempDir);
-    if (!result.appendFile(basename))
+    if (!result.appendComponent(basename))
       throw basename + ": can't use this file name";
     if (!result.appendSuffix(suffix))
       throw suffix + ": can't use this file suffix";
@@ -448,13 +448,13 @@
   llvm::sys::Path GetPathForLinkageItem(const std::string& link_item,
                                         bool native = false) {
     sys::Path fullpath;
-    fullpath.setFile(link_item);
+    fullpath.set(link_item);
     if (fullpath.canRead())
       return fullpath;
     for (PathVector::iterator PI = LibraryPaths.begin(),
          PE = LibraryPaths.end(); PI != PE; ++PI) {
-      fullpath.setDirectory(PI->toString());
-      fullpath.appendFile(link_item);
+      fullpath.set(PI->toString());
+      fullpath.appendComponent(link_item);
       if (fullpath.canRead())
         return fullpath;
       if (native) {
@@ -463,16 +463,16 @@
         fullpath.appendSuffix("bc");
         if (fullpath.canRead())
           return fullpath;
-        fullpath.elideSuffix();
+        fullpath.eraseSuffix();
         fullpath.appendSuffix("o");
         if (fullpath.canRead())
           return fullpath;
         fullpath = *PI;
-        fullpath.appendFile(std::string("lib") + link_item);
+        fullpath.appendComponent(std::string("lib") + link_item);
         fullpath.appendSuffix("a");
         if (fullpath.canRead())
           return fullpath;
-        fullpath.elideSuffix();
+        fullpath.eraseSuffix();
         fullpath.appendSuffix("so");
         if (fullpath.canRead())
           return fullpath;
@@ -693,7 +693,7 @@
               /// The output of the translator is an LLVM Assembly program
               /// We need to translate it to bytecode
               Action* action = new Action();
-              action->program.setFile("llvm-as");
+              action->program.set("llvm-as");
               action->args.push_back(InFile.toString());
               action->args.push_back("-o");
               InFile.appendSuffix("bc");
@@ -735,7 +735,7 @@
                 /// The output of the optimizer is an LLVM Assembly program
                 /// We need to translate it to bytecode with llvm-as
                 Action* action = new Action();
-                action->program.setFile("llvm-as");
+                action->program.set("llvm-as");
                 action->args.push_back(InFile.toString());
                 action->args.push_back("-f");
                 action->args.push_back("-o");
@@ -764,7 +764,7 @@
           Action* action = new Action();
           if (isSet(EMIT_NATIVE_FLAG)) {
             // Use llc to get the native assembly file
-            action->program.setFile("llc");
+            action->program.set("llc");
             action->args.push_back(InFile.toString());
             action->args.push_back("-f");
             action->args.push_back("-o");
@@ -777,7 +777,7 @@
             actions.push_back(action);
           } else {
             // Just convert back to llvm assembly with llvm-dis
-            action->program.setFile("llvm-dis");
+            action->program.set("llvm-dis");
             action->args.push_back(InFile.toString());
             action->args.push_back("-f");
             action->args.push_back("-o");
@@ -820,7 +820,7 @@
 
         // Set up the linking action with llvm-ld
         Action* link = new Action();
-        link->program.setFile("llvm-ld");
+        link->program.set("llvm-ld");
 
         // Add in the optimization level requested
         switch (optLevel) {


Index: llvm/tools/llvmc/Configuration.cpp
diff -u llvm/tools/llvmc/Configuration.cpp:1.22 llvm/tools/llvmc/Configuration.cpp:1.23
--- llvm/tools/llvmc/Configuration.cpp:1.22	Thu Jul  7 13:21:42 2005
+++ llvm/tools/llvmc/Configuration.cpp	Thu Jul  7 18:21:43 2005
@@ -318,7 +318,7 @@
         {
           std::string progname;
           if (parseProgramName(progname))
-            action.program.setFile(progname);
+            action.program.set(progname);
           else
             error("Expecting a program name");
 
@@ -547,8 +547,8 @@
     // Try the environment variable
     const char* conf = getenv("LLVM_CONFIG_DIR");
     if (conf) {
-      confFile.setDirectory(conf);
-      confFile.appendFile(ftype);
+      confFile.set(conf);
+      confFile.appendComponent(ftype);
       if (!confFile.canRead())
         throw std::string("Configuration file for '") + ftype +
                           "' is not available.";
@@ -556,20 +556,20 @@
       // Try the user's home directory
       confFile = sys::Path::GetUserHomeDirectory();
       if (!confFile.isEmpty()) {
-        confFile.appendDirectory(".llvm");
-        confFile.appendDirectory("etc");
-        confFile.appendFile(ftype);
+        confFile.appendComponent(".llvm");
+        confFile.appendComponent("etc");
+        confFile.appendComponent(ftype);
         if (!confFile.canRead())
           confFile.clear();
       }
       if (confFile.isEmpty()) {
         // Okay, try the LLVM installation directory
         confFile = sys::Path::GetLLVMConfigDir();
-        confFile.appendFile(ftype);
+        confFile.appendComponent(ftype);
         if (!confFile.canRead()) {
           // Okay, try the "standard" place
           confFile = sys::Path::GetLLVMDefaultConfigDir();
-          confFile.appendFile(ftype);
+          confFile.appendComponent(ftype);
           if (!confFile.canRead()) {
             throw std::string("Configuration file for '") + ftype +
                               "' is not available.";
@@ -579,7 +579,7 @@
     }
   } else {
     confFile = configDir;
-    confFile.appendFile(ftype);
+    confFile.appendComponent(ftype);
     if (!confFile.canRead())
       throw std::string("Configuration file for '") + ftype +
                         "' is not available.";






More information about the llvm-commits mailing list