[Lldb-commits] [lldb] r334618 - [FileSpec] Simplify getting extension and stem.
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Wed Jun 13 09:36:07 PDT 2018
Author: jdevlieghere
Date: Wed Jun 13 09:36:07 2018
New Revision: 334618
URL: http://llvm.org/viewvc/llvm-project?rev=334618&view=rev
Log:
[FileSpec] Simplify getting extension and stem.
As noted by Pavel on lldb-commits, we don't need the temp path, we can
just pass the filename directly into extension() and path().
Modified:
lldb/trunk/source/Utility/FileSpec.cpp
Modified: lldb/trunk/source/Utility/FileSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/FileSpec.cpp?rev=334618&r1=334617&r2=334618&view=diff
==============================================================================
--- lldb/trunk/source/Utility/FileSpec.cpp (original)
+++ lldb/trunk/source/Utility/FileSpec.cpp Wed Jun 13 09:36:07 2018
@@ -585,17 +585,12 @@ void FileSpec::GetPath(llvm::SmallVector
}
ConstString FileSpec::GetFileNameExtension() const {
- llvm::SmallString<64> current_path;
- current_path.append(m_filename.GetStringRef().begin(),
- m_filename.GetStringRef().end());
- return ConstString(llvm::sys::path::extension(current_path, m_style));
+ return ConstString(
+ llvm::sys::path::extension(m_filename.GetStringRef(), m_style));
}
ConstString FileSpec::GetFileNameStrippingExtension() const {
- llvm::SmallString<64> current_path;
- current_path.append(m_filename.GetStringRef().begin(),
- m_filename.GetStringRef().end());
- return ConstString(llvm::sys::path::stem(current_path, m_style));
+ return ConstString(llvm::sys::path::stem(m_filename.GetStringRef(), m_style));
}
//------------------------------------------------------------------
More information about the lldb-commits
mailing list