[llvm] 6c7a53b - [llvm] Add lifetimebound to llvm::sys::path::filename, etc. (#122890)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 14 05:18:40 PST 2025


Author: Utkarsh Saxena
Date: 2025-01-14T14:18:36+01:00
New Revision: 6c7a53b78fd695ee58ea42d21362f6fa861eb37e

URL: https://github.com/llvm/llvm-project/commit/6c7a53b78fd695ee58ea42d21362f6fa861eb37e
DIFF: https://github.com/llvm/llvm-project/commit/6c7a53b78fd695ee58ea42d21362f6fa861eb37e.diff

LOG: [llvm] Add lifetimebound to llvm::sys::path::filename, etc. (#122890)

Added: 
    

Modified: 
    llvm/include/llvm/Support/Path.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Support/Path.h b/llvm/include/llvm/Support/Path.h
index ce69f32b6cc81b..ce549a995c4ddc 100644
--- a/llvm/include/llvm/Support/Path.h
+++ b/llvm/include/llvm/Support/Path.h
@@ -119,22 +119,24 @@ class reverse_iterator
 /// Get begin iterator over \a path.
 /// @param path Input path.
 /// @returns Iterator initialized with the first component of \a path.
-const_iterator begin(StringRef path, Style style = Style::native);
+const_iterator begin(StringRef path LLVM_LIFETIME_BOUND,
+                     Style style = Style::native);
 
 /// Get end iterator over \a path.
 /// @param path Input path.
 /// @returns Iterator initialized to the end of \a path.
-const_iterator end(StringRef path);
+const_iterator end(StringRef path LLVM_LIFETIME_BOUND);
 
 /// Get reverse begin iterator over \a path.
 /// @param path Input path.
 /// @returns Iterator initialized with the first reverse component of \a path.
-reverse_iterator rbegin(StringRef path, Style style = Style::native);
+reverse_iterator rbegin(StringRef path LLVM_LIFETIME_BOUND,
+                        Style style = Style::native);
 
 /// Get reverse end iterator over \a path.
 /// @param path Input path.
 /// @returns Iterator initialized to the reverse end of \a path.
-reverse_iterator rend(StringRef path);
+reverse_iterator rend(StringRef path LLVM_LIFETIME_BOUND);
 
 /// @}
 /// @name Lexical Modifiers
@@ -199,7 +201,8 @@ bool replace_path_prefix(SmallVectorImpl<char> &Path, StringRef OldPrefix,
 ///
 /// @param path Input path.
 /// @result The cleaned-up \a path.
-StringRef remove_leading_dotslash(StringRef path, Style style = Style::native);
+StringRef remove_leading_dotslash(StringRef path LLVM_LIFETIME_BOUND,
+                                  Style style = Style::native);
 
 /// In-place remove any './' and optionally '../' components from a path.
 ///
@@ -295,7 +298,8 @@ std::string convert_to_slash(StringRef path, Style style = Style::native);
 ///
 /// @param path Input path.
 /// @result The root name of \a path if it has one, otherwise "".
-StringRef root_name(StringRef path, Style style = Style::native);
+StringRef root_name(StringRef path LLVM_LIFETIME_BOUND,
+                    Style style = Style::native);
 
 /// Get root directory.
 ///
@@ -308,7 +312,8 @@ StringRef root_name(StringRef path, Style style = Style::native);
 /// @param path Input path.
 /// @result The root directory of \a path if it has one, otherwise
 ///               "".
-StringRef root_directory(StringRef path, Style style = Style::native);
+StringRef root_directory(StringRef path LLVM_LIFETIME_BOUND,
+                         Style style = Style::native);
 
 /// Get root path.
 ///
@@ -316,7 +321,8 @@ StringRef root_directory(StringRef path, Style style = Style::native);
 ///
 /// @param path Input path.
 /// @result The root path of \a path if it has one, otherwise "".
-StringRef root_path(StringRef path, Style style = Style::native);
+StringRef root_path(StringRef path LLVM_LIFETIME_BOUND,
+                    Style style = Style::native);
 
 /// Get relative path.
 ///
@@ -328,7 +334,8 @@ StringRef root_path(StringRef path, Style style = Style::native);
 ///
 /// @param path Input path.
 /// @result The path starting after root_path if one exists, otherwise "".
-StringRef relative_path(StringRef path, Style style = Style::native);
+StringRef relative_path(StringRef path LLVM_LIFETIME_BOUND,
+                        Style style = Style::native);
 
 /// Get parent path.
 ///
@@ -340,7 +347,8 @@ StringRef relative_path(StringRef path, Style style = Style::native);
 ///
 /// @param path Input path.
 /// @result The parent path of \a path if one exists, otherwise "".
-StringRef parent_path(StringRef path, Style style = Style::native);
+StringRef parent_path(StringRef path LLVM_LIFETIME_BOUND,
+                      Style style = Style::native);
 
 /// Get filename.
 ///
@@ -354,7 +362,8 @@ StringRef parent_path(StringRef path, Style style = Style::native);
 /// @param path Input path.
 /// @result The filename part of \a path. This is defined as the last component
 ///         of \a path. Similar to the POSIX "basename" utility.
-StringRef filename(StringRef path, Style style = Style::native);
+StringRef filename(StringRef path LLVM_LIFETIME_BOUND,
+                   Style style = Style::native);
 
 /// Get stem.
 ///
@@ -372,7 +381,7 @@ StringRef filename(StringRef path, Style style = Style::native);
 ///
 /// @param path Input path.
 /// @result The stem of \a path.
-StringRef stem(StringRef path, Style style = Style::native);
+StringRef stem(StringRef path LLVM_LIFETIME_BOUND, Style style = Style::native);
 
 /// Get extension.
 ///
@@ -388,7 +397,8 @@ StringRef stem(StringRef path, Style style = Style::native);
 ///
 /// @param path Input path.
 /// @result The extension of \a path.
-StringRef extension(StringRef path, Style style = Style::native);
+StringRef extension(StringRef path LLVM_LIFETIME_BOUND,
+                    Style style = Style::native);
 
 /// Check whether the given char is a path separator on the host OS.
 ///


        


More information about the llvm-commits mailing list