Skip to content

Commit c3183ed

Browse files
committed
Support: Update documentation for Program functions
The docstrings were describing an older interface that has been replaced with functions. Also describe the performance characteristics of FindProgramByName() and ExecuteAndWait() explaining when it's best to avoid them. llvm-svn: 196932
1 parent 58f6a1f commit c3183ed

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

llvm/include/llvm/Support/Program.h

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,16 @@ struct ProcessInfo {
5252
ProcessInfo();
5353
};
5454

55-
/// This static constructor (factory) will attempt to locate a program in
56-
/// the operating system's file system using some pre-determined set of
57-
/// locations to search (e.g. the PATH on Unix). Paths with slashes are
58-
/// returned unmodified.
59-
/// @returns A Path object initialized to the path of the program or a
60-
/// Path object that is empty (invalid) if the program could not be found.
61-
/// @brief Construct a Program by finding it by name.
55+
/// This function attempts to locate a program in the operating
56+
/// system's file system using some pre-determined set of locations to search
57+
/// (e.g. the PATH on Unix). Paths with slashes are returned unmodified.
58+
///
59+
/// It does not perform hashing as a shell would but instead stats each PATH
60+
/// entry individually so should generally be avoided. Core LLVM library
61+
/// functions and options should instead require fully specified paths.
62+
///
63+
/// @returns A string containing the path of the program or an empty string if
64+
/// the program could not be found.
6265
std::string FindProgramByName(const std::string& name);
6366

6467
// These functions change the specified standard stream (stdin, stdout, or
@@ -72,7 +75,9 @@ struct ProcessInfo {
7275
/// invoked program will inherit the stdin, stdout, and stderr file
7376
/// descriptors, the environment and other configuration settings of the
7477
/// invoking program.
75-
/// This function waits the program to finish.
78+
/// This function waits for the program to finish, so should be avoided in
79+
/// library functions that aren't expected to block. Consider using
80+
/// ExecuteNoWait() instead.
7681
/// @returns an integer result code indicating the status of the program.
7782
/// A zero or positive value indicates the result code of the program.
7883
/// -1 indicates failure to execute

0 commit comments

Comments
 (0)