]> granicus.if.org Git - clang/commitdiff
Replace all uses of PathV1::get{Basename,Dirname,Suffix} with their PathV2 equivalents.
authorMichael J. Spencer <bigcheesegs@gmail.com>
Sat, 18 Dec 2010 04:13:32 +0000 (04:13 +0000)
committerMichael J. Spencer <bigcheesegs@gmail.com>
Sat, 18 Dec 2010 04:13:32 +0000 (04:13 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122140 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Checker/AnalysisConsumer.cpp
lib/Driver/Driver.cpp
lib/Rewrite/FrontendActions.cpp
tools/driver/driver.cpp

index 52dd06803468f5044584dbf809a41c9a0c09f020..52066f14aa9b92f53f4fead56838fd40105a6b9b 100644 (file)
@@ -50,8 +50,8 @@ static ExplodedNode::Auditor* CreateUbiViz();
 static PathDiagnosticClient*
 createPlistHTMLDiagnosticClient(const std::string& prefix,
                                 const Preprocessor &PP) {
-  llvm::sys::Path F(prefix);
-  PathDiagnosticClient *PD = createHTMLDiagnosticClient(F.getDirname(), PP);
+  PathDiagnosticClient *PD =
+    createHTMLDiagnosticClient(llvm::sys::path::parent_path(prefix), PP);
   return createPlistDiagnosticClient(prefix, PP, PD);
 }
 
index e24ec077718d5301b1878ebcf9772da088cbeb3a..8340c0f129e90cd6eeb774628ba07b9507a5250d 100644 (file)
@@ -77,21 +77,16 @@ Driver::Driver(llvm::StringRef _ClangExecutable,
       CCCUseClangCXX = false;
   }
 
-  llvm::sys::Path Executable(ClangExecutable);
-  Name = Executable.getBasename();
-  Dir = Executable.getDirname();
+  Name = llvm::sys::path::stem(ClangExecutable);
+  Dir  = llvm::sys::path::parent_path(ClangExecutable);
 
   // Compute the path to the resource directory.
   llvm::StringRef ClangResourceDir(CLANG_RESOURCE_DIR);
-  llvm::sys::Path P(Dir);
-  if (ClangResourceDir != "") {
-    P.appendComponent(ClangResourceDir);
-  } else {
-    P.appendComponent(".."); // Walk up from a 'bin' subdirectory.
-    P.appendComponent("lib");
-    P.appendComponent("clang");
-    P.appendComponent(CLANG_VERSION_STRING);
-  }
+  llvm::SmallString<128> P(Dir);
+  if (ClangResourceDir != "")
+    llvm::sys::path::append(P, ClangResourceDir);
+  else
+    llvm::sys::path::append(P, "..", "lib", "clang", CLANG_VERSION_STRING);
   ResourceDir = P.str();
 }
 
index ec99ace18a92a06d54c923ddd20888c2f752e6dd..33e79edaf93bff89c7248aec6b24c03de5646246 100644 (file)
@@ -58,11 +58,10 @@ public:
   }
 
   std::string RewriteFilename(const std::string &Filename) {
-    llvm::sys::Path Path(Filename);
-    std::string Suffix = Path.getSuffix();
-    Path.eraseSuffix();
-    Path.appendSuffix(NewSuffix + "." + Suffix);
-    return Path.c_str();
+    llvm::SmallString<128> Path(Filename);
+    llvm::sys::path::replace_extension(Path,
+      NewSuffix + llvm::sys::path::extension(Path));
+    return Path.str();
   }
 };
 } // end anonymous namespace
index cd249c46dd1d7b3e90f167e3c11196967d32fb27..c88a7a30540f6cf0ea0a22b3daad21d80815f34b 100644 (file)
@@ -287,7 +287,7 @@ int main(int argc_, const char **argv_) {
 
   TextDiagnosticPrinter *DiagClient
     = new TextDiagnosticPrinter(llvm::errs(), DiagnosticOptions());
-  DiagClient->setPrefix(Path.getBasename());
+  DiagClient->setPrefix(llvm::sys::path::stem(Path.str()));
   llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
   Diagnostic Diags(DiagID, DiagClient);
 
@@ -331,7 +331,7 @@ int main(int argc_, const char **argv_) {
   //
   // We use *argv instead of argv[0] to work around a bogus g++ warning.
   const char *progname = argv_[0];
-  std::string ProgName(llvm::sys::Path(progname).getBasename());
+  std::string ProgName(llvm::sys::path::stem(progname));
   if (llvm::StringRef(ProgName).endswith("++") ||
       llvm::StringRef(ProgName).rsplit('-').first.endswith("++")) {
     TheDriver.CCCIsCXX = true;