aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2010-12-18 04:13:32 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2010-12-18 04:13:32 +0000
commitd5b08bee799d4f77f1a25fa5977ca77b983ab031 (patch)
tree426542f5871a92a87a6c0723bf9a46cb46b02f8d
parent2b364a43f50efd3d82177c29a79e66895ab335ad (diff)
Replace all uses of PathV1::get{Basename,Dirname,Suffix} with their PathV2 equivalents.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122140 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Checker/AnalysisConsumer.cpp4
-rw-r--r--lib/Driver/Driver.cpp19
-rw-r--r--lib/Rewrite/FrontendActions.cpp9
-rw-r--r--tools/driver/driver.cpp4
4 files changed, 15 insertions, 21 deletions
diff --git a/lib/Checker/AnalysisConsumer.cpp b/lib/Checker/AnalysisConsumer.cpp
index 52dd068034..52066f14aa 100644
--- a/lib/Checker/AnalysisConsumer.cpp
+++ b/lib/Checker/AnalysisConsumer.cpp
@@ -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);
}
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
index e24ec07771..8340c0f129 100644
--- a/lib/Driver/Driver.cpp
+++ b/lib/Driver/Driver.cpp
@@ -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();
}
diff --git a/lib/Rewrite/FrontendActions.cpp b/lib/Rewrite/FrontendActions.cpp
index ec99ace18a..33e79edaf9 100644
--- a/lib/Rewrite/FrontendActions.cpp
+++ b/lib/Rewrite/FrontendActions.cpp
@@ -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
diff --git a/tools/driver/driver.cpp b/tools/driver/driver.cpp
index cd249c46dd..c88a7a3054 100644
--- a/tools/driver/driver.cpp
+++ b/tools/driver/driver.cpp
@@ -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;