aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2010-12-18 00:19:12 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2010-12-18 00:19:12 +0000
commit472ccff00cdbcd095c3ba933b9e3f202719f118f (patch)
treea2e0da6cafcc26882139c047fe98a16e752664ec
parentdf344dfb663f99184e734f5d14b5fc9b2725aec2 (diff)
Replace all uses of PathV1::getLast with PathV2::filename.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122117 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Checker/HTMLDiagnostics.cpp2
-rw-r--r--lib/Driver/Driver.cpp10
-rw-r--r--lib/Driver/Tools.cpp12
-rw-r--r--tools/driver/driver.cpp6
-rw-r--r--tools/libclang/CIndexUSRs.cpp3
5 files changed, 15 insertions, 18 deletions
diff --git a/lib/Checker/HTMLDiagnostics.cpp b/lib/Checker/HTMLDiagnostics.cpp
index b175fcaaeb..7fcb0256dd 100644
--- a/lib/Checker/HTMLDiagnostics.cpp
+++ b/lib/Checker/HTMLDiagnostics.cpp
@@ -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)
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
index e8cfd711a3..e24ec07771 100644
--- a/lib/Driver/Driver.cpp
+++ b/lib/Driver/Driver.cpp
@@ -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);
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 7674fdcf38..4e23ed6dda 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -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,
diff --git a/tools/driver/driver.cpp b/tools/driver/driver.cpp
index d210a4018a..cd249c46dd 100644
--- a/tools/driver/driver.cpp
+++ b/tools/driver/driver.cpp
@@ -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;
}
diff --git a/tools/libclang/CIndexUSRs.cpp b/tools/libclang/CIndexUSRs.cpp
index 8a1d4233c1..5861ee6309 100644
--- a/tools/libclang/CIndexUSRs.cpp
+++ b/tools/libclang/CIndexUSRs.cpp
@@ -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.