Skip to content

Commit 6c7a53b

Browse files
authored
[llvm] Add lifetimebound to llvm::sys::path::filename, etc. (#122890)
1 parent d2d4c3b commit 6c7a53b

File tree

1 file changed

+23
-13
lines changed
  • llvm/include/llvm/Support

1 file changed

+23
-13
lines changed

llvm/include/llvm/Support/Path.h

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -119,22 +119,24 @@ class reverse_iterator
119119
/// Get begin iterator over \a path.
120120
/// @param path Input path.
121121
/// @returns Iterator initialized with the first component of \a path.
122-
const_iterator begin(StringRef path, Style style = Style::native);
122+
const_iterator begin(StringRef path LLVM_LIFETIME_BOUND,
123+
Style style = Style::native);
123124

124125
/// Get end iterator over \a path.
125126
/// @param path Input path.
126127
/// @returns Iterator initialized to the end of \a path.
127-
const_iterator end(StringRef path);
128+
const_iterator end(StringRef path LLVM_LIFETIME_BOUND);
128129

129130
/// Get reverse begin iterator over \a path.
130131
/// @param path Input path.
131132
/// @returns Iterator initialized with the first reverse component of \a path.
132-
reverse_iterator rbegin(StringRef path, Style style = Style::native);
133+
reverse_iterator rbegin(StringRef path LLVM_LIFETIME_BOUND,
134+
Style style = Style::native);
133135

134136
/// Get reverse end iterator over \a path.
135137
/// @param path Input path.
136138
/// @returns Iterator initialized to the reverse end of \a path.
137-
reverse_iterator rend(StringRef path);
139+
reverse_iterator rend(StringRef path LLVM_LIFETIME_BOUND);
138140

139141
/// @}
140142
/// @name Lexical Modifiers
@@ -199,7 +201,8 @@ bool replace_path_prefix(SmallVectorImpl<char> &Path, StringRef OldPrefix,
199201
///
200202
/// @param path Input path.
201203
/// @result The cleaned-up \a path.
202-
StringRef remove_leading_dotslash(StringRef path, Style style = Style::native);
204+
StringRef remove_leading_dotslash(StringRef path LLVM_LIFETIME_BOUND,
205+
Style style = Style::native);
203206

204207
/// In-place remove any './' and optionally '../' components from a path.
205208
///
@@ -295,7 +298,8 @@ std::string convert_to_slash(StringRef path, Style style = Style::native);
295298
///
296299
/// @param path Input path.
297300
/// @result The root name of \a path if it has one, otherwise "".
298-
StringRef root_name(StringRef path, Style style = Style::native);
301+
StringRef root_name(StringRef path LLVM_LIFETIME_BOUND,
302+
Style style = Style::native);
299303

300304
/// Get root directory.
301305
///
@@ -308,15 +312,17 @@ StringRef root_name(StringRef path, Style style = Style::native);
308312
/// @param path Input path.
309313
/// @result The root directory of \a path if it has one, otherwise
310314
/// "".
311-
StringRef root_directory(StringRef path, Style style = Style::native);
315+
StringRef root_directory(StringRef path LLVM_LIFETIME_BOUND,
316+
Style style = Style::native);
312317

313318
/// Get root path.
314319
///
315320
/// Equivalent to root_name + root_directory.
316321
///
317322
/// @param path Input path.
318323
/// @result The root path of \a path if it has one, otherwise "".
319-
StringRef root_path(StringRef path, Style style = Style::native);
324+
StringRef root_path(StringRef path LLVM_LIFETIME_BOUND,
325+
Style style = Style::native);
320326

321327
/// Get relative path.
322328
///
@@ -328,7 +334,8 @@ StringRef root_path(StringRef path, Style style = Style::native);
328334
///
329335
/// @param path Input path.
330336
/// @result The path starting after root_path if one exists, otherwise "".
331-
StringRef relative_path(StringRef path, Style style = Style::native);
337+
StringRef relative_path(StringRef path LLVM_LIFETIME_BOUND,
338+
Style style = Style::native);
332339

333340
/// Get parent path.
334341
///
@@ -340,7 +347,8 @@ StringRef relative_path(StringRef path, Style style = Style::native);
340347
///
341348
/// @param path Input path.
342349
/// @result The parent path of \a path if one exists, otherwise "".
343-
StringRef parent_path(StringRef path, Style style = Style::native);
350+
StringRef parent_path(StringRef path LLVM_LIFETIME_BOUND,
351+
Style style = Style::native);
344352

345353
/// Get filename.
346354
///
@@ -354,7 +362,8 @@ StringRef parent_path(StringRef path, Style style = Style::native);
354362
/// @param path Input path.
355363
/// @result The filename part of \a path. This is defined as the last component
356364
/// of \a path. Similar to the POSIX "basename" utility.
357-
StringRef filename(StringRef path, Style style = Style::native);
365+
StringRef filename(StringRef path LLVM_LIFETIME_BOUND,
366+
Style style = Style::native);
358367

359368
/// Get stem.
360369
///
@@ -372,7 +381,7 @@ StringRef filename(StringRef path, Style style = Style::native);
372381
///
373382
/// @param path Input path.
374383
/// @result The stem of \a path.
375-
StringRef stem(StringRef path, Style style = Style::native);
384+
StringRef stem(StringRef path LLVM_LIFETIME_BOUND, Style style = Style::native);
376385

377386
/// Get extension.
378387
///
@@ -388,7 +397,8 @@ StringRef stem(StringRef path, Style style = Style::native);
388397
///
389398
/// @param path Input path.
390399
/// @result The extension of \a path.
391-
StringRef extension(StringRef path, Style style = Style::native);
400+
StringRef extension(StringRef path LLVM_LIFETIME_BOUND,
401+
Style style = Style::native);
392402

393403
/// Check whether the given char is a path separator on the host OS.
394404
///

0 commit comments

Comments
 (0)