[llvm-commits] [llvm] r122149 - in /llvm/trunk: include/llvm/Support/PathV1.h lib/CompilerDriver/CompilationGraph.cpp lib/CompilerDriver/Main.cpp lib/CompilerDriver/Tool.cpp lib/Linker/LinkModules.cpp tools/llvm-ld/llvm-ld.cpp utils/KillTheDoctor/KillTheDoctor.cpp

Owen Anderson resistor at mac.com
Fri Dec 17 23:37:18 PST 2010


Author: resistor
Date: Sat Dec 18 01:37:18 2010
New Revision: 122149

URL: http://llvm.org/viewvc/llvm-project?rev=122149&view=rev
Log:
Revert r122143 through r122140, which collectively broke the LLVMC tests on
the buildbots.

Modified:
    llvm/trunk/include/llvm/Support/PathV1.h
    llvm/trunk/lib/CompilerDriver/CompilationGraph.cpp
    llvm/trunk/lib/CompilerDriver/Main.cpp
    llvm/trunk/lib/CompilerDriver/Tool.cpp
    llvm/trunk/lib/Linker/LinkModules.cpp
    llvm/trunk/tools/llvm-ld/llvm-ld.cpp
    llvm/trunk/utils/KillTheDoctor/KillTheDoctor.cpp

Modified: llvm/trunk/include/llvm/Support/PathV1.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/PathV1.h?rev=122149&r1=122148&r2=122149&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/PathV1.h (original)
+++ llvm/trunk/include/llvm/Support/PathV1.h Sat Dec 18 01:37:18 2010
@@ -21,10 +21,8 @@
 #include <string>
 #include <vector>
 
-#define LLVMV_PATH_DEPRECATED_MSG(replacement) \
-  "PathV1 has been deprecated and will be removed as soon as all LLVM and" \
-  " Clang clients have been moved over to PathV2. Please use `" #replacement \
-  "` from PathV2 instead."
+#define LLVMV_PATH_DEPRECATED_MSG \
+  "PathV1 is being deprecated, please use the PathV2 API."
 
 namespace llvm {
 namespace sys {
@@ -267,20 +265,18 @@
       /// @brief Returns the last component of the path name.
       LLVM_ATTRIBUTE_DEPRECATED(
         StringRef getLast() const,
-        LLVMV_PATH_DEPRECATED_MSG(path::filename));
+        LLVMV_PATH_DEPRECATED_MSG);
 
       /// This function strips off the path and suffix of the file or directory
       /// name and returns just the basename. For example /a/foo.bar would cause
       /// this function to return "foo".
       /// @returns StringRef containing the basename of the path
       /// @brief Get the base name of the path
-      LLVM_ATTRIBUTE_DEPRECATED(StringRef getBasename() const,
-        LLVMV_PATH_DEPRECATED_MSG(path::stem));
+      StringRef getBasename() const;
 
       /// This function strips off the suffix of the path beginning with the
       /// path separator ('/' on Unix, '\' on Windows) and returns the result.
-      LLVM_ATTRIBUTE_DEPRECATED(StringRef getDirname() const,
-        LLVMV_PATH_DEPRECATED_MSG(path::parent_path));
+      StringRef getDirname() const;
 
       /// This function strips off the path and basename(up to and
       /// including the last dot) of the file or directory name and
@@ -288,8 +284,7 @@
       /// this function to return "bar".
       /// @returns StringRef containing the suffix of the path
       /// @brief Get the suffix of the path
-      LLVM_ATTRIBUTE_DEPRECATED(StringRef getSuffix() const,
-        LLVMV_PATH_DEPRECATED_MSG(path::extension));
+      StringRef getSuffix() const;
 
       /// Obtain a 'C' string for the path name.
       /// @returns a 'C' string containing the path name.
@@ -313,14 +308,14 @@
       /// @brief Determine if the path is absolute.
       LLVM_ATTRIBUTE_DEPRECATED(
         bool isAbsolute() const,
-        LLVMV_PATH_DEPRECATED_MSG(path::is_absolute));
+        LLVMV_PATH_DEPRECATED_MSG);
 
       /// This function determines if the path name is absolute, as opposed to
       /// relative.
       /// @brief Determine if the path is absolute.
       LLVM_ATTRIBUTE_DEPRECATED(
         static bool isAbsolute(const char *NameStart, unsigned NameLen),
-        LLVMV_PATH_DEPRECATED_MSG(path::is_absolute));
+        LLVMV_PATH_DEPRECATED_MSG);
 
       /// This function opens the file associated with the path name provided by
       /// the Path object and reads its magic number. If the magic number at the

Modified: llvm/trunk/lib/CompilerDriver/CompilationGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CompilerDriver/CompilationGraph.cpp?rev=122149&r1=122148&r2=122149&view=diff
==============================================================================
--- llvm/trunk/lib/CompilerDriver/CompilationGraph.cpp (original)
+++ llvm/trunk/lib/CompilerDriver/CompilationGraph.cpp Sat Dec 18 01:37:18 2010
@@ -32,7 +32,7 @@
 namespace llvmc {
 
   const std::string* LanguageMap::GetLanguage(const sys::Path& File) const {
-    StringRef suf = sys::path::extension(File.str());
+    StringRef suf = File.getSuffix();
     LanguageMap::const_iterator Lang =
       this->find(suf.empty() ? "*empty*" : suf);
     if (Lang == this->end()) {

Modified: llvm/trunk/lib/CompilerDriver/Main.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CompilerDriver/Main.cpp?rev=122149&r1=122148&r2=122149&view=diff
==============================================================================
--- llvm/trunk/lib/CompilerDriver/Main.cpp (original)
+++ llvm/trunk/lib/CompilerDriver/Main.cpp Sat Dec 18 01:37:18 2010
@@ -43,7 +43,8 @@
       return 0;
     }
     else if (SaveTemps == SaveTempsEnum::Obj && !OutputFilename.empty()) {
-      tempDir = sys::path::parent_path(OutputFilename);
+      tempDir = OutputFilename;
+      tempDir = tempDir.getDirname();
     }
     else {
       // SaveTemps == Cwd --> use current dir (leave tempDir empty).

Modified: llvm/trunk/lib/CompilerDriver/Tool.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CompilerDriver/Tool.cpp?rev=122149&r1=122148&r2=122149&view=diff
==============================================================================
--- llvm/trunk/lib/CompilerDriver/Tool.cpp (original)
+++ llvm/trunk/lib/CompilerDriver/Tool.cpp Sat Dec 18 01:37:18 2010
@@ -61,7 +61,7 @@
       Out.appendSuffix(OutputSuffix);
     }
     else {
-      Out.set(sys::path::stem(In.str()));
+      Out.set(In.getBasename());
       Out.appendSuffix(OutputSuffix);
     }
   }
@@ -69,7 +69,7 @@
     if (IsJoin())
       Out = MakeTempFile(TempDir, "tmp", OutputSuffix);
     else
-      Out = MakeTempFile(TempDir, sys::path::stem(In.str()), OutputSuffix);
+      Out = MakeTempFile(TempDir, In.getBasename(), OutputSuffix);
   }
   return Out;
 }

Modified: llvm/trunk/lib/Linker/LinkModules.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkModules.cpp?rev=122149&r1=122148&r2=122149&view=diff
==============================================================================
--- llvm/trunk/lib/Linker/LinkModules.cpp (original)
+++ llvm/trunk/lib/Linker/LinkModules.cpp Sat Dec 18 01:37:18 2010
@@ -449,7 +449,7 @@
     const NamedMDNode *SrcNMD = I;
     NamedMDNode *DestNMD = Dest->getOrInsertNamedMetadata(SrcNMD->getName());
     // Add Src elements into Dest node.
-    for (unsigned i = 0, e = SrcNMD->getNumOperands(); i != e; ++i)
+    for (unsigned i = 0, e = SrcNMD->getNumOperands(); i != e; ++i) 
       DestNMD->addOperand(cast<MDNode>(MapValue(SrcNMD->getOperand(i),
                                                 ValueMap,
                                                 true)));
@@ -559,14 +559,14 @@
       // we are replacing may be a function (if a prototype, weak, etc) or a
       // global variable.
       GlobalVariable *NewDGV =
-        new GlobalVariable(*Dest, SGV->getType()->getElementType(),
-                           SGV->isConstant(), NewLinkage, /*init*/0,
+        new GlobalVariable(*Dest, SGV->getType()->getElementType(), 
+                           SGV->isConstant(), NewLinkage, /*init*/0, 
                            DGV->getName(), 0, false,
                            SGV->getType()->getAddressSpace());
 
       // Propagate alignment, section, and visibility info.
       CopyGVAttributes(NewDGV, SGV);
-      DGV->replaceAllUsesWith(ConstantExpr::getBitCast(NewDGV,
+      DGV->replaceAllUsesWith(ConstantExpr::getBitCast(NewDGV, 
                                                               DGV->getType()));
 
       // DGV will conflict with NewDGV because they both had the same
@@ -928,7 +928,7 @@
       CopyGVAttributes(NewDF, SF);
 
       // Any uses of DF need to change to NewDF, with cast
-      DGV->replaceAllUsesWith(ConstantExpr::getBitCast(NewDF,
+      DGV->replaceAllUsesWith(ConstantExpr::getBitCast(NewDF, 
                                                               DGV->getType()));
 
       // DF will conflict with NewDF because they both had the same. We must
@@ -1017,7 +1017,7 @@
         Value *Old = MI->second;
         if (!isa<Instruction>(Old) && !isa<BasicBlock>(Old)) {
           Value *New = MapValue(Old, ValueMap, true);
-          if (New != Old)
+          if (New != Old) 
             I->setMetadata(MI->first, cast<MDNode>(New));
         }
       }
@@ -1100,7 +1100,7 @@
          "Appending variables with different section name need to be linked!");
 
       unsigned NewSize = T1->getNumElements() + T2->getNumElements();
-      ArrayType *NewType = ArrayType::get(T1->getElementType(),
+      ArrayType *NewType = ArrayType::get(T1->getElementType(), 
                                                          NewSize);
 
       G1->setName("");   // Clear G1's name in case of a conflict!
@@ -1144,7 +1144,7 @@
       // getelementptr instructions to not use the Cast!
       G1->replaceAllUsesWith(ConstantExpr::getBitCast(NG,
                              G1->getType()));
-      G2->replaceAllUsesWith(ConstantExpr::getBitCast(NG,
+      G2->replaceAllUsesWith(ConstantExpr::getBitCast(NG, 
                              G2->getType()));
 
       // Remove the two globals from the module now...
@@ -1301,9 +1301,10 @@
 
   // If the source library's module id is in the dependent library list of the
   // destination library, remove it since that module is now linked in.
-  const std::string &modId = Src->getModuleIdentifier();
-  if (!modId.empty())
-    Dest->removeLibrary(sys::path::stem(modId));
+  sys::Path modId;
+  modId.set(Src->getModuleIdentifier());
+  if (!modId.isEmpty())
+    Dest->removeLibrary(modId.getBasename());
 
   return false;
 }

Modified: llvm/trunk/tools/llvm-ld/llvm-ld.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ld/llvm-ld.cpp?rev=122149&r1=122148&r2=122149&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-ld/llvm-ld.cpp (original)
+++ llvm/trunk/tools/llvm-ld/llvm-ld.cpp Sat Dec 18 01:37:18 2010
@@ -526,7 +526,7 @@
   initializeTarget(Registry);
 
   // Initial global variable above for convenience printing of program name.
-  progname = sys::path::stem(argv[0]);
+  progname = sys::Path(argv[0]).getBasename();
 
   // Parse the command line options
   cl::ParseCommandLineOptions(argc, argv, "llvm linker\n");
@@ -538,8 +538,11 @@
       OutputFilename = "a.exe";
 
     // If there is no suffix add an "exe" one.
-    if (sys::path::extension(OutputFilename).empty())
-      OutputFilename.append(".exe");
+    sys::Path ExeFile( OutputFilename );
+    if (ExeFile.getSuffix() == "") {
+      ExeFile.appendSuffix("exe");
+      OutputFilename = ExeFile.str();
+    }
   }
 #endif
 

Modified: llvm/trunk/utils/KillTheDoctor/KillTheDoctor.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/KillTheDoctor/KillTheDoctor.cpp?rev=122149&r1=122148&r2=122149&view=diff
==============================================================================
--- llvm/trunk/utils/KillTheDoctor/KillTheDoctor.cpp (original)
+++ llvm/trunk/utils/KillTheDoctor/KillTheDoctor.cpp Sat Dec 18 01:37:18 2010
@@ -523,7 +523,7 @@
           errs().indent(ToolName.size()) << ": DLL Name : " << DLLName << '\n';
         }
 
-        if (NoUser32 && sys::path::stem(DLLName) == "user32") {
+        if (NoUser32 && sys::Path(DLLName).getBasename() == "user32") {
           // Program is loading user32.dll, in the applications we are testing,
           // this only happens if an assert has fired. By now the message has
           // already been printed, so simply close the program.





More information about the llvm-commits mailing list