diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2018-06-13 16:36:07 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2018-06-13 16:36:07 +0000 |
commit | 9c1a645adc524fd337e4df1a01172a4bbc8d0a14 (patch) | |
tree | bbeb8f54158f8c3ba2833716cf12f098c7469628 | |
parent | d5690628db4e9cc41b4103df887822bfc36c3354 (diff) | |
download | llvm-9c1a645adc524fd337e4df1a01172a4bbc8d0a14.zip llvm-9c1a645adc524fd337e4df1a01172a4bbc8d0a14.tar.gz llvm-9c1a645adc524fd337e4df1a01172a4bbc8d0a14.tar.bz2 |
[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().
llvm-svn: 334618
-rw-r--r-- | lldb/source/Utility/FileSpec.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/lldb/source/Utility/FileSpec.cpp b/lldb/source/Utility/FileSpec.cpp index b3436e4..ebb18d5 100644 --- a/lldb/source/Utility/FileSpec.cpp +++ b/lldb/source/Utility/FileSpec.cpp @@ -585,17 +585,12 @@ void FileSpec::GetPath(llvm::SmallVectorImpl<char> &path, } 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)); } //------------------------------------------------------------------ |