[Lldb-commits] [lldb] r180713 - Don't return a reference to a local variable, and removed a redundant API.
Greg Clayton
gclayton at apple.com
Mon Apr 29 09:36:28 PDT 2013
Author: gclayton
Date: Mon Apr 29 11:36:27 2013
New Revision: 180713
URL: http://llvm.org/viewvc/llvm-project?rev=180713&view=rev
Log:
Don't return a reference to a local variable, and removed a redundant API.
Modified:
lldb/trunk/include/lldb/Host/FileSpec.h
lldb/trunk/source/Host/common/FileSpec.cpp
Modified: lldb/trunk/include/lldb/Host/FileSpec.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSpec.h?rev=180713&r1=180712&r2=180713&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/FileSpec.h (original)
+++ lldb/trunk/include/lldb/Host/FileSpec.h Mon Apr 29 11:36:27 2013
@@ -385,23 +385,12 @@ public:
///
/// Extract the directory and path into a std::string, which is returned.
///
- /// @param[out] path
- /// The directory + filename returned in this std::string reference.
- //------------------------------------------------------------------
- void
- GetPath (std::string &path) const;
-
- //------------------------------------------------------------------
- /// Extract the full path to the file.
- ///
- /// Extract the directory and path into a std::string, which is returned.
- ///
/// @return
/// Returns a std::string with the directory and filename
/// concatenated.
//------------------------------------------------------------------
- std::string&
- GetPath (void) const;
+ std::string
+ GetPath () const;
//------------------------------------------------------------------
/// Extract the extension of the file.
Modified: lldb/trunk/source/Host/common/FileSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSpec.cpp?rev=180713&r1=180712&r2=180713&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/FileSpec.cpp (original)
+++ lldb/trunk/source/Host/common/FileSpec.cpp Mon Apr 29 11:36:27 2013
@@ -702,12 +702,12 @@ FileSpec::GetPath(char *path, size_t pat
return 0;
}
-void
-FileSpec::GetPath (std::string &path) const
+std::string
+FileSpec::GetPath (void) const
{
+ std::string path;
const char *dirname = m_directory.GetCString();
const char *filename = m_filename.GetCString();
- path.clear();
if (dirname)
{
path.append (dirname);
@@ -715,17 +715,7 @@ FileSpec::GetPath (std::string &path) co
path.append ("/");
}
if (filename)
- {
path.append (filename);
- }
-}
-
-
-std::string&
-FileSpec::GetPath (void) const
-{
- std::string path;
- GetPath (path);
return path;
}
More information about the lldb-commits
mailing list