mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-06 04:31:08 +00:00
Pass StringRefs by value, for consistency.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122074 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
090100fdb1
commit
d53f3c864b
@ -605,7 +605,7 @@ class directory_iterator {
|
|||||||
|
|
||||||
// Platform implementations implement these functions to handle iteration.
|
// Platform implementations implement these functions to handle iteration.
|
||||||
friend error_code directory_iterator_construct(directory_iterator &it,
|
friend error_code directory_iterator_construct(directory_iterator &it,
|
||||||
const StringRef &path);
|
StringRef path);
|
||||||
friend error_code directory_iterator_increment(directory_iterator &it);
|
friend error_code directory_iterator_increment(directory_iterator &it);
|
||||||
friend error_code directory_iterator_destruct(directory_iterator &it);
|
friend error_code directory_iterator_destruct(directory_iterator &it);
|
||||||
|
|
||||||
|
@ -52,8 +52,8 @@ class const_iterator {
|
|||||||
size_t Position; //< The iterators current position within Path.
|
size_t Position; //< The iterators current position within Path.
|
||||||
|
|
||||||
// An end iterator has Position = Path.size() + 1.
|
// An end iterator has Position = Path.size() + 1.
|
||||||
friend const_iterator begin(const StringRef &path);
|
friend const_iterator begin(StringRef path);
|
||||||
friend const_iterator end(const StringRef &path);
|
friend const_iterator end(StringRef path);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef const StringRef value_type;
|
typedef const StringRef value_type;
|
||||||
@ -80,24 +80,24 @@ typedef std::reverse_iterator<const_iterator> reverse_iterator;
|
|||||||
/// @brief Get begin iterator over \a path.
|
/// @brief Get begin iterator over \a path.
|
||||||
/// @param path Input path.
|
/// @param path Input path.
|
||||||
/// @returns Iterator initialized with the first component of \a 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.
|
/// @brief Get end iterator over \a path.
|
||||||
/// @param path Input path.
|
/// @param path Input path.
|
||||||
/// @returns Iterator initialized to the end of \a 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.
|
/// @brief Get reverse begin iterator over \a path.
|
||||||
/// @param path Input path.
|
/// @param path Input path.
|
||||||
/// @returns Iterator initialized with the first reverse component of \a 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));
|
return reverse_iterator(end(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Get reverse end iterator over \a path.
|
/// @brief Get reverse end iterator over \a path.
|
||||||
/// @param path Input path.
|
/// @param path Input path.
|
||||||
/// @returns Iterator initialized to the reverse end of \a 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));
|
return reverse_iterator(begin(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ void native(const Twine &path, SmallVectorImpl<char> &result);
|
|||||||
///
|
///
|
||||||
/// @param path Input path.
|
/// @param path Input path.
|
||||||
/// @result The root name of \a path if it has one, otherwise "".
|
/// @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.
|
/// @brief Get root directory.
|
||||||
///
|
///
|
||||||
@ -186,7 +186,7 @@ const StringRef root_name(const StringRef &path);
|
|||||||
/// @param path Input path.
|
/// @param path Input path.
|
||||||
/// @result The root directory of \a path if it has one, otherwise
|
/// @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.
|
/// @brief Get root path.
|
||||||
///
|
///
|
||||||
@ -194,7 +194,7 @@ const StringRef root_directory(const StringRef &path);
|
|||||||
///
|
///
|
||||||
/// @param path Input path.
|
/// @param path Input path.
|
||||||
/// @result The root path of \a path if it has one, otherwise "".
|
/// @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.
|
/// @brief Get relative path.
|
||||||
///
|
///
|
||||||
@ -204,7 +204,7 @@ const StringRef root_path(const StringRef &path);
|
|||||||
///
|
///
|
||||||
/// @param path Input path.
|
/// @param path Input path.
|
||||||
/// @result The path starting after root_path if one exists, otherwise "".
|
/// @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.
|
/// @brief Get parent path.
|
||||||
///
|
///
|
||||||
@ -214,7 +214,7 @@ const StringRef relative_path(const StringRef &path);
|
|||||||
///
|
///
|
||||||
/// @param path Input path.
|
/// @param path Input path.
|
||||||
/// @result The parent path of \a path if one exists, otherwise "".
|
/// @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.
|
/// @brief Get filename.
|
||||||
///
|
///
|
||||||
@ -226,7 +226,7 @@ const StringRef parent_path(const StringRef &path);
|
|||||||
/// @param path Input path.
|
/// @param path Input path.
|
||||||
/// @result The filename part of \a path. This is defined as the last component
|
/// @result The filename part of \a path. This is defined as the last component
|
||||||
/// of \a path.
|
/// of \a path.
|
||||||
const StringRef filename(const StringRef &path);
|
const StringRef filename(StringRef path);
|
||||||
|
|
||||||
/// @brief Get stem.
|
/// @brief Get stem.
|
||||||
///
|
///
|
||||||
@ -242,7 +242,7 @@ const StringRef filename(const StringRef &path);
|
|||||||
///
|
///
|
||||||
/// @param path Input path.
|
/// @param path Input path.
|
||||||
/// @result The stem of \a path.
|
/// @result The stem of \a path.
|
||||||
const StringRef stem(const StringRef &path);
|
const StringRef stem(StringRef path);
|
||||||
|
|
||||||
/// @brief Get extension.
|
/// @brief Get extension.
|
||||||
///
|
///
|
||||||
@ -256,7 +256,7 @@ const StringRef stem(const StringRef &path);
|
|||||||
///
|
///
|
||||||
/// @param path Input path.
|
/// @param path Input path.
|
||||||
/// @result The extension of \a path.
|
/// @result The extension of \a path.
|
||||||
const StringRef extension(const StringRef &path);
|
const StringRef extension(StringRef path);
|
||||||
|
|
||||||
/// @brief Has root name?
|
/// @brief Has root name?
|
||||||
///
|
///
|
||||||
|
@ -89,7 +89,7 @@ namespace {
|
|||||||
return StringRef();
|
return StringRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t filename_pos(const StringRef &str) {
|
size_t filename_pos(StringRef str) {
|
||||||
if (str.size() == 2 &&
|
if (str.size() == 2 &&
|
||||||
is_separator(str[0]) &&
|
is_separator(str[0]) &&
|
||||||
str[0] == str[1])
|
str[0] == str[1])
|
||||||
@ -112,7 +112,7 @@ namespace {
|
|||||||
return pos + 1;
|
return pos + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t root_dir_start(const StringRef &str) {
|
size_t root_dir_start(StringRef str) {
|
||||||
// case "c:/"
|
// case "c:/"
|
||||||
#ifdef LLVM_ON_WIN32
|
#ifdef LLVM_ON_WIN32
|
||||||
if (str.size() > 2 &&
|
if (str.size() > 2 &&
|
||||||
@ -142,7 +142,7 @@ namespace {
|
|||||||
return StringRef::npos;
|
return StringRef::npos;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t parent_path_end(const StringRef &path) {
|
size_t parent_path_end(StringRef path) {
|
||||||
size_t end_pos = filename_pos(path);
|
size_t end_pos = filename_pos(path);
|
||||||
|
|
||||||
bool filename_was_sep = path.size() > 0 && is_separator(path[end_pos]);
|
bool filename_was_sep = path.size() > 0 && is_separator(path[end_pos]);
|
||||||
@ -166,7 +166,7 @@ namespace llvm {
|
|||||||
namespace sys {
|
namespace sys {
|
||||||
namespace path {
|
namespace path {
|
||||||
|
|
||||||
const_iterator begin(const StringRef &path) {
|
const_iterator begin(StringRef path) {
|
||||||
const_iterator i;
|
const_iterator i;
|
||||||
i.Path = path;
|
i.Path = path;
|
||||||
i.Component = find_first_component(path);
|
i.Component = find_first_component(path);
|
||||||
@ -174,7 +174,7 @@ const_iterator begin(const StringRef &path) {
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
const_iterator end(const StringRef &path) {
|
const_iterator end(StringRef path) {
|
||||||
const_iterator i;
|
const_iterator i;
|
||||||
i.Path = path;
|
i.Path = path;
|
||||||
i.Position = path.size();
|
i.Position = path.size();
|
||||||
@ -279,7 +279,7 @@ ptrdiff_t const_iterator::operator-(const const_iterator &RHS) const {
|
|||||||
return Position - RHS.Position;
|
return Position - RHS.Position;
|
||||||
}
|
}
|
||||||
|
|
||||||
const StringRef root_path(const StringRef &path) {
|
const StringRef root_path(StringRef path) {
|
||||||
const_iterator b = begin(path),
|
const_iterator b = begin(path),
|
||||||
pos = b,
|
pos = b,
|
||||||
e = end(path);
|
e = end(path);
|
||||||
@ -311,7 +311,7 @@ const StringRef root_path(const StringRef &path) {
|
|||||||
return StringRef();
|
return StringRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
const StringRef root_name(const StringRef &path) {
|
const StringRef root_name(StringRef path) {
|
||||||
const_iterator b = begin(path),
|
const_iterator b = begin(path),
|
||||||
e = end(path);
|
e = end(path);
|
||||||
if (b != e) {
|
if (b != e) {
|
||||||
@ -333,7 +333,7 @@ const StringRef root_name(const StringRef &path) {
|
|||||||
return StringRef();
|
return StringRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
const StringRef root_directory(const StringRef &path) {
|
const StringRef root_directory(StringRef path) {
|
||||||
const_iterator b = begin(path),
|
const_iterator b = begin(path),
|
||||||
pos = b,
|
pos = b,
|
||||||
e = end(path);
|
e = end(path);
|
||||||
@ -362,7 +362,7 @@ const StringRef root_directory(const StringRef &path) {
|
|||||||
return StringRef();
|
return StringRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
const StringRef relative_path(const StringRef &path) {
|
const StringRef relative_path(StringRef path) {
|
||||||
StringRef root = root_path(path);
|
StringRef root = root_path(path);
|
||||||
return StringRef(path.begin() + root.size(), path.size() - root.size());
|
return StringRef(path.begin() + root.size(), path.size() - root.size());
|
||||||
}
|
}
|
||||||
@ -408,7 +408,7 @@ void append(SmallVectorImpl<char> &path, const Twine &a,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const StringRef parent_path(const StringRef &path) {
|
const StringRef parent_path(StringRef path) {
|
||||||
size_t end_pos = parent_path_end(path);
|
size_t end_pos = parent_path_end(path);
|
||||||
if (end_pos == StringRef::npos)
|
if (end_pos == StringRef::npos)
|
||||||
return StringRef();
|
return StringRef();
|
||||||
@ -461,11 +461,11 @@ void native(const Twine &path, SmallVectorImpl<char> &result) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
const StringRef filename(const StringRef &path) {
|
const StringRef filename(StringRef path) {
|
||||||
return *(--end(path));
|
return *(--end(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
const StringRef stem(const StringRef &path) {
|
const StringRef stem(StringRef path) {
|
||||||
StringRef fname = filename(path);
|
StringRef fname = filename(path);
|
||||||
size_t pos = fname.find_last_of('.');
|
size_t pos = fname.find_last_of('.');
|
||||||
if (pos == StringRef::npos)
|
if (pos == StringRef::npos)
|
||||||
@ -478,7 +478,7 @@ const StringRef stem(const StringRef &path) {
|
|||||||
return StringRef(fname.begin(), pos);
|
return StringRef(fname.begin(), pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
const StringRef extension(const StringRef &path) {
|
const StringRef extension(StringRef path) {
|
||||||
StringRef fname = filename(path);
|
StringRef fname = filename(path);
|
||||||
size_t pos = fname.find_last_of('.');
|
size_t pos = fname.find_last_of('.');
|
||||||
if (pos == StringRef::npos)
|
if (pos == StringRef::npos)
|
||||||
|
@ -400,7 +400,7 @@ MBlazeOperand *MBlazeAsmParser::ParseRegister() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned MatchFslRegister(const StringRef &String) {
|
static unsigned MatchFslRegister(StringRef String) {
|
||||||
if (!String.startswith("rfsl"))
|
if (!String.startswith("rfsl"))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user