]> granicus.if.org Git - clang/commitdiff
Replace all uses of PathV1::getLast with PathV2::filename.
authorMichael J. Spencer <bigcheesegs@gmail.com>
Sat, 18 Dec 2010 00:19:12 +0000 (00:19 +0000)
committerMichael J. Spencer <bigcheesegs@gmail.com>
Sat, 18 Dec 2010 00:19:12 +0000 (00:19 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122117 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Checker/HTMLDiagnostics.cpp
lib/Driver/Driver.cpp
lib/Driver/Tools.cpp
tools/driver/driver.cpp
tools/libclang/CIndexUSRs.cpp

index b175fcaaeb8266e73dda08c8dc74f0014c22b5a7..7fcb0256ddffd017fc76e529e79bbb709bf6bfac 100644 (file)
@@ -300,7 +300,7 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D,
   }
 
   if (FilesMade)
-    FilesMade->push_back(H.getLast());
+    FilesMade->push_back(llvm::sys::path::filename(H.str()));
 
   // Emit the HTML to disk.
   for (RewriteBuffer::iterator I = Buf->begin(), E = Buf->end(); I!=E; ++I)
index e8cfd711a3ba0719a5b9e090796a2691f46d4bb6..e24ec077718d5301b1878ebcf9772da088cbeb3a 100644 (file)
@@ -1195,8 +1195,8 @@ const char *Driver::GetNamedOutputPath(Compilation &C,
     return C.addTempFile(C.getArgs().MakeArgString(TmpName.c_str()));
   }
 
-  llvm::sys::Path BasePath(BaseInput);
-  std::string BaseName(BasePath.getLast());
+  llvm::SmallString<128> BasePath(BaseInput);
+  llvm::StringRef BaseName = llvm::sys::path::filename(BasePath);
 
   // Determine what the derived output name should be.
   const char *NamedOutput;
@@ -1217,11 +1217,11 @@ const char *Driver::GetNamedOutputPath(Compilation &C,
 
   // As an annoying special case, PCH generation doesn't strip the pathname.
   if (JA.getType() == types::TY_PCH) {
-    BasePath.eraseComponent();
-    if (BasePath.isEmpty())
+    llvm::sys::path::remove_filename(BasePath);
+    if (BasePath.empty())
       BasePath = NamedOutput;
     else
-      BasePath.appendComponent(NamedOutput);
+      llvm::sys::path::append(BasePath, NamedOutput);
     return C.addResultFile(C.getArgs().MakeArgString(BasePath.c_str()));
   } else {
     return C.addResultFile(NamedOutput);
index 7674fdcf38fa11281ef26dfa3774193ee929a1ce..4e23ed6dda4369b27d093a67c6e16ed7fb91e4ab 100644 (file)
@@ -167,11 +167,9 @@ void Clang::AddPreprocessingOptions(const Driver &D,
         // Otherwise derive from the base input.
         //
         // FIXME: This should use the computed output file location.
-        llvm::sys::Path P(Inputs[0].getBaseInput());
-
-        P.eraseSuffix();
-        P.appendSuffix("o");
-        DepTarget = Args.MakeArgString(P.getLast());
+        llvm::SmallString<128> P(Inputs[0].getBaseInput());
+        llvm::sys::path::replace_extension(P, "o");
+        DepTarget = Args.MakeArgString(llvm::sys::path::filename(P));
       }
 
       CmdArgs.push_back("-MT");
@@ -1926,8 +1924,8 @@ const char *darwin::CC1::getCC1Name(types::ID Type) const {
 
 const char *darwin::CC1::getBaseInputName(const ArgList &Args,
                                           const InputInfoList &Inputs) {
-  llvm::sys::Path P(Inputs[0].getBaseInput());
-  return Args.MakeArgString(P.getLast());
+  return Args.MakeArgString(
+    llvm::sys::path::filename(Inputs[0].getBaseInput()));
 }
 
 const char *darwin::CC1::getBaseInputStem(const ArgList &Args,
index d210a4018a3ce7dda47efc96b503c66659df3047..cd249c46dd1d7b3e90f167e3c11196967d32fb27 100644 (file)
@@ -312,9 +312,9 @@ int main(int argc_, const char **argv_) {
   llvm::sys::Path InstalledPath(argv[0]);
 
   // Do a PATH lookup, if there are no directory components.
-  if (InstalledPath.getLast() == InstalledPath.str()) {
-    llvm::sys::Path Tmp =
-      llvm::sys::Program::FindProgramByName(InstalledPath.getLast());
+  if (llvm::sys::path::filename(InstalledPath.str()) == InstalledPath.str()) {
+    llvm::sys::Path Tmp = llvm::sys::Program::FindProgramByName(
+      llvm::sys::path::filename(InstalledPath.str()));
     if (!Tmp.empty())
       InstalledPath = Tmp;
   }
index 8a1d4233c1afa937452f5c0ce3bbad08f4833847..5861ee6309dcf2d73fd80df71416fb54a3d9ead9 100644 (file)
@@ -488,8 +488,7 @@ bool USRGenerator::GenLoc(const Decl *D) {
   const std::pair<FileID, unsigned> &Decomposed = SM.getDecomposedLoc(L);
   const FileEntry *FE = SM.getFileEntryForID(Decomposed.first);
   if (FE) {
-    llvm::sys::Path P(FE->getName());
-    Out << P.getLast();
+    Out << llvm::sys::path::filename(FE->getName());
   }
   else {
     // This case really isn't interesting.