[llvm-commits] [llvm] r122141 - in /llvm/trunk: include/llvm/Support/PathV1.h lib/CompilerDriver/CompilationGraph.cpp lib/CompilerDriver/Main.cpp lib/CompilerDriver/Tool.cpp lib/Linker/LinkModules.cpp tools/llvm-ld/llvm-ld.cpp utils/KillTheDoctor/KillTheDoctor.cpp
Michael J. Spencer
bigcheesegs at gmail.com
Fri Dec 17 20:13:36 PST 2010
Author: mspencer
Date: Fri Dec 17 22:13:36 2010
New Revision: 122141
URL: http://llvm.org/viewvc/llvm-project?rev=122141&view=rev
Log:
Support/PathV1: Deprecate get{Basename,Dirname,Suffix}.
Modified:
llvm/trunk/include/llvm/Support/PathV1.h
llvm/trunk/lib/CompilerDriver/CompilationGraph.cpp
llvm/trunk/lib/CompilerDriver/Main.cpp
llvm/trunk/lib/CompilerDriver/Tool.cpp
llvm/trunk/lib/Linker/LinkModules.cpp
llvm/trunk/tools/llvm-ld/llvm-ld.cpp
llvm/trunk/utils/KillTheDoctor/KillTheDoctor.cpp
Modified: llvm/trunk/include/llvm/Support/PathV1.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/PathV1.h?rev=122141&r1=122140&r2=122141&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/PathV1.h (original)
+++ llvm/trunk/include/llvm/Support/PathV1.h Fri Dec 17 22:13:36 2010
@@ -272,11 +272,13 @@
/// this function to return "foo".
/// @returns StringRef containing the basename of the path
/// @brief Get the base name of the path
- StringRef getBasename() const;
+ LLVM_ATTRIBUTE_DEPRECATED(StringRef getBasename() const,
+ LLVMV_PATH_DEPRECATED_MSG);
/// This function strips off the suffix of the path beginning with the
/// path separator ('/' on Unix, '\' on Windows) and returns the result.
- StringRef getDirname() const;
+ LLVM_ATTRIBUTE_DEPRECATED(StringRef getDirname() const,
+ LLVMV_PATH_DEPRECATED_MSG);
/// This function strips off the path and basename(up to and
/// including the last dot) of the file or directory name and
@@ -284,7 +286,8 @@
/// this function to return "bar".
/// @returns StringRef containing the suffix of the path
/// @brief Get the suffix of the path
- StringRef getSuffix() const;
+ LLVM_ATTRIBUTE_DEPRECATED(StringRef getSuffix() const,
+ LLVMV_PATH_DEPRECATED_MSG);
/// Obtain a 'C' string for the path name.
/// @returns a 'C' string containing the path name.
Modified: llvm/trunk/lib/CompilerDriver/CompilationGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CompilerDriver/CompilationGraph.cpp?rev=122141&r1=122140&r2=122141&view=diff
==============================================================================
--- llvm/trunk/lib/CompilerDriver/CompilationGraph.cpp (original)
+++ llvm/trunk/lib/CompilerDriver/CompilationGraph.cpp Fri Dec 17 22:13:36 2010
@@ -32,7 +32,7 @@
namespace llvmc {
const std::string* LanguageMap::GetLanguage(const sys::Path& File) const {
- StringRef suf = File.getSuffix();
+ StringRef suf = sys::path::extension(File.str());
LanguageMap::const_iterator Lang =
this->find(suf.empty() ? "*empty*" : suf);
if (Lang == this->end()) {
Modified: llvm/trunk/lib/CompilerDriver/Main.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CompilerDriver/Main.cpp?rev=122141&r1=122140&r2=122141&view=diff
==============================================================================
--- llvm/trunk/lib/CompilerDriver/Main.cpp (original)
+++ llvm/trunk/lib/CompilerDriver/Main.cpp Fri Dec 17 22:13:36 2010
@@ -43,8 +43,7 @@
return 0;
}
else if (SaveTemps == SaveTempsEnum::Obj && !OutputFilename.empty()) {
- tempDir = OutputFilename;
- tempDir = tempDir.getDirname();
+ tempDir = sys::path::parent_path(OutputFilename);
}
else {
// SaveTemps == Cwd --> use current dir (leave tempDir empty).
Modified: llvm/trunk/lib/CompilerDriver/Tool.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CompilerDriver/Tool.cpp?rev=122141&r1=122140&r2=122141&view=diff
==============================================================================
--- llvm/trunk/lib/CompilerDriver/Tool.cpp (original)
+++ llvm/trunk/lib/CompilerDriver/Tool.cpp Fri Dec 17 22:13:36 2010
@@ -61,7 +61,7 @@
Out.appendSuffix(OutputSuffix);
}
else {
- Out.set(In.getBasename());
+ Out.set(sys::path::stem(In.str()));
Out.appendSuffix(OutputSuffix);
}
}
@@ -69,7 +69,7 @@
if (IsJoin())
Out = MakeTempFile(TempDir, "tmp", OutputSuffix);
else
- Out = MakeTempFile(TempDir, In.getBasename(), OutputSuffix);
+ Out = MakeTempFile(TempDir, sys::path::stem(In.str()), OutputSuffix);
}
return Out;
}
Modified: llvm/trunk/lib/Linker/LinkModules.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkModules.cpp?rev=122141&r1=122140&r2=122141&view=diff
==============================================================================
--- llvm/trunk/lib/Linker/LinkModules.cpp (original)
+++ llvm/trunk/lib/Linker/LinkModules.cpp Fri Dec 17 22:13:36 2010
@@ -1301,10 +1301,9 @@
// If the source library's module id is in the dependent library list of the
// destination library, remove it since that module is now linked in.
- sys::Path modId;
- modId.set(Src->getModuleIdentifier());
- if (!modId.isEmpty())
- Dest->removeLibrary(modId.getBasename());
+ const std::string &modId = Src->getModuleIdentifier();
+ if (!modId.empty())
+ Dest->removeLibrary(sys::path::stem(modId));
return false;
}
Modified: llvm/trunk/tools/llvm-ld/llvm-ld.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ld/llvm-ld.cpp?rev=122141&r1=122140&r2=122141&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-ld/llvm-ld.cpp (original)
+++ llvm/trunk/tools/llvm-ld/llvm-ld.cpp Fri Dec 17 22:13:36 2010
@@ -526,7 +526,7 @@
initializeTarget(Registry);
// Initial global variable above for convenience printing of program name.
- progname = sys::Path(argv[0]).getBasename();
+ progname = sys::path::stem(argv[0]);
// Parse the command line options
cl::ParseCommandLineOptions(argc, argv, "llvm linker\n");
@@ -538,11 +538,8 @@
OutputFilename = "a.exe";
// If there is no suffix add an "exe" one.
- sys::Path ExeFile( OutputFilename );
- if (ExeFile.getSuffix() == "") {
- ExeFile.appendSuffix("exe");
- OutputFilename = ExeFile.str();
- }
+ if (sys::path::extension(OutputFilename).empty())
+ OutputFilename.append(".exe");
}
#endif
Modified: llvm/trunk/utils/KillTheDoctor/KillTheDoctor.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/KillTheDoctor/KillTheDoctor.cpp?rev=122141&r1=122140&r2=122141&view=diff
==============================================================================
--- llvm/trunk/utils/KillTheDoctor/KillTheDoctor.cpp (original)
+++ llvm/trunk/utils/KillTheDoctor/KillTheDoctor.cpp Fri Dec 17 22:13:36 2010
@@ -523,7 +523,7 @@
errs().indent(ToolName.size()) << ": DLL Name : " << DLLName << '\n';
}
- if (NoUser32 && sys::Path(DLLName).getBasename() == "user32") {
+ if (NoUser32 && sys::path::stem(DLLName) == "user32") {
// Program is loading user32.dll, in the applications we are testing,
// this only happens if an assert has fired. By now the message has
// already been printed, so simply close the program.
More information about the llvm-commits
mailing list