diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2010-12-17 18:19:06 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2010-12-17 18:19:06 +0000 |
commit | d53f3c864bf94d158a2ae677fe92fd41afaec2f3 (patch) | |
tree | 43c0e82f0d0d92603b1644e09b46732a5f153bde /include/llvm/Support | |
parent | 090100fdb166e87bc539e3e4048d18c721c187d0 (diff) |
Pass StringRefs by value, for consistency.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122074 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support')
-rw-r--r-- | include/llvm/Support/FileSystem.h | 8 | ||||
-rw-r--r-- | include/llvm/Support/PathV2.h | 28 |
2 files changed, 18 insertions, 18 deletions
diff --git a/include/llvm/Support/FileSystem.h b/include/llvm/Support/FileSystem.h index 5263d32153..2a2daaeced 100644 --- a/include/llvm/Support/FileSystem.h +++ b/include/llvm/Support/FileSystem.h @@ -604,10 +604,10 @@ class directory_iterator { directory_entry CurrentEntry; // Platform implementations implement these functions to handle iteration. - friend error_code directory_iterator_construct(directory_iterator& it, - const StringRef &path); - friend error_code directory_iterator_increment(directory_iterator& it); - friend error_code directory_iterator_destruct(directory_iterator& it); + friend error_code directory_iterator_construct(directory_iterator &it, + StringRef path); + friend error_code directory_iterator_increment(directory_iterator &it); + friend error_code directory_iterator_destruct(directory_iterator &it); public: explicit directory_iterator(const Twine &path, error_code &ec) diff --git a/include/llvm/Support/PathV2.h b/include/llvm/Support/PathV2.h index acb66d772a..3866e410e6 100644 --- a/include/llvm/Support/PathV2.h +++ b/include/llvm/Support/PathV2.h @@ -52,8 +52,8 @@ class const_iterator { size_t Position; //< The iterators current position within Path. // An end iterator has Position = Path.size() + 1. - friend const_iterator begin(const StringRef &path); - friend const_iterator end(const StringRef &path); + friend const_iterator begin(StringRef path); + friend const_iterator end(StringRef path); public: typedef const StringRef value_type; @@ -80,24 +80,24 @@ typedef std::reverse_iterator<const_iterator> reverse_iterator; /// @brief Get begin iterator over \a path. /// @param path Input path. /// @returns Iterator initialized with the first component of \a path. -const_iterator begin(const StringRef &path); +const_iterator begin(StringRef path); /// @brief Get end iterator over \a path. /// @param path Input path. /// @returns Iterator initialized to the end of \a path. -const_iterator end(const StringRef &path); +const_iterator end(StringRef path); /// @brief Get reverse begin iterator over \a path. /// @param path Input path. /// @returns Iterator initialized with the first reverse component of \a path. -inline reverse_iterator rbegin(const StringRef &path) { +inline reverse_iterator rbegin(StringRef path) { return reverse_iterator(end(path)); } /// @brief Get reverse end iterator over \a path. /// @param path Input path. /// @returns Iterator initialized to the reverse end of \a path. -inline reverse_iterator rend(const StringRef &path) { +inline reverse_iterator rend(StringRef path) { return reverse_iterator(begin(path)); } @@ -175,7 +175,7 @@ void native(const Twine &path, SmallVectorImpl<char> &result); /// /// @param path Input path. /// @result The root name of \a path if it has one, otherwise "". -const StringRef root_name(const StringRef &path); +const StringRef root_name(StringRef path); /// @brief Get root directory. /// @@ -186,7 +186,7 @@ const StringRef root_name(const StringRef &path); /// @param path Input path. /// @result The root directory of \a path if it has one, otherwise /// "". -const StringRef root_directory(const StringRef &path); +const StringRef root_directory(StringRef path); /// @brief Get root path. /// @@ -194,7 +194,7 @@ const StringRef root_directory(const StringRef &path); /// /// @param path Input path. /// @result The root path of \a path if it has one, otherwise "". -const StringRef root_path(const StringRef &path); +const StringRef root_path(StringRef path); /// @brief Get relative path. /// @@ -204,7 +204,7 @@ const StringRef root_path(const StringRef &path); /// /// @param path Input path. /// @result The path starting after root_path if one exists, otherwise "". -const StringRef relative_path(const StringRef &path); +const StringRef relative_path(StringRef path); /// @brief Get parent path. /// @@ -214,7 +214,7 @@ const StringRef relative_path(const StringRef &path); /// /// @param path Input path. /// @result The parent path of \a path if one exists, otherwise "". -const StringRef parent_path(const StringRef &path); +const StringRef parent_path(StringRef path); /// @brief Get filename. /// @@ -226,7 +226,7 @@ const StringRef parent_path(const StringRef &path); /// @param path Input path. /// @result The filename part of \a path. This is defined as the last component /// of \a path. -const StringRef filename(const StringRef &path); +const StringRef filename(StringRef path); /// @brief Get stem. /// @@ -242,7 +242,7 @@ const StringRef filename(const StringRef &path); /// /// @param path Input path. /// @result The stem of \a path. -const StringRef stem(const StringRef &path); +const StringRef stem(StringRef path); /// @brief Get extension. /// @@ -256,7 +256,7 @@ const StringRef stem(const StringRef &path); /// /// @param path Input path. /// @result The extension of \a path. -const StringRef extension(const StringRef &path); +const StringRef extension(StringRef path); /// @brief Has root name? /// |