summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2011-08-26 22:27:02 +0000
committerChad Rosier <mcrosier@apple.com>2011-08-26 22:27:02 +0000
commit97c373793bd73c09c27bd59ba9ed15197cc20558 (patch)
tree84dfb502f4114a69c5ea57326fae049fe46b5ca5 /clang/lib
parentb9d4e377760e86a5146dfb7c8fadb10e354749b4 (diff)
downloadbcm5719-llvm-97c373793bd73c09c27bd59ba9ed15197cc20558.tar.gz
bcm5719-llvm-97c373793bd73c09c27bd59ba9ed15197cc20558.zip
Cleanup r138662 per Ben and David's suggestions, thanks.
llvm-svn: 138670
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Driver/Driver.cpp21
1 files changed, 7 insertions, 14 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 66d2df16e11..534984b4b3a 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -1335,15 +1335,6 @@ void Driver::BuildJobsForAction(Compilation &C,
}
}
-// Strip the directory and suffix from BaseInput.
-static std::string getBaseName (const char *BaseInput) {
- std::pair<StringRef, StringRef> Split = StringRef(BaseInput).rsplit('/');
- if (Split.second != "")
- return Split.second.split('.').first.str();
- else
- return Split.first.split('.').first.str();
-}
-
const char *Driver::GetNamedOutputPath(Compilation &C,
const JobAction &JA,
const char *BaseInput,
@@ -1363,9 +1354,10 @@ const char *Driver::GetNamedOutputPath(Compilation &C,
// Output to a temporary file?
if ((!AtTopLevel && !C.getArgs().hasArg(options::OPT_save_temps)) ||
CCGenDiagnostics) {
+ StringRef Name = llvm::sys::path::filename(BaseInput);
+ std::pair<StringRef, StringRef> Split = Name.split('.');
std::string TmpName =
- GetTemporaryPath(getBaseName(BaseInput).c_str(),
- types::getTypeTempSuffix(JA.getType()));
+ GetTemporaryPath(Split.first, types::getTypeTempSuffix(JA.getType()));
return C.addTempFile(C.getArgs().MakeArgString(TmpName.c_str()));
}
@@ -1399,9 +1391,10 @@ const char *Driver::GetNamedOutputPath(Compilation &C,
// filename, then avoid overwriting input file.
if (!AtTopLevel && C.getArgs().hasArg(options::OPT_save_temps) &&
NamedOutput == BaseName) {
+ StringRef Name = llvm::sys::path::filename(BaseInput);
+ std::pair<StringRef, StringRef> Split = Name.split('.');
std::string TmpName =
- GetTemporaryPath(getBaseName(BaseInput).c_str(),
- types::getTypeTempSuffix(JA.getType()));
+ GetTemporaryPath(Split.first, types::getTypeTempSuffix(JA.getType()));
return C.addTempFile(C.getArgs().MakeArgString(TmpName.c_str()));
}
@@ -1486,7 +1479,7 @@ std::string Driver::GetProgramPath(const char *Name, const ToolChain &TC,
return Name;
}
-std::string Driver::GetTemporaryPath(const char *Prefix, const char *Suffix)
+std::string Driver::GetTemporaryPath(StringRef Prefix, const char *Suffix)
const {
// FIXME: This is lame; sys::Path should provide this function (in particular,
// it should know how to find the temporary files dir).
OpenPOWER on IntegriCloud