forked from OSchip/llvm-project
[lldb][NFC] Minor comment and inlining fixes for Args
The element count getter can just be in the header. Also doxygenify some of the comments and document m_argv's terminating nullptr element that the other comments keep mentioning.
This commit is contained in:
parent
b0f4ffbfaa
commit
6e1afd8587
|
@ -115,7 +115,8 @@ public:
|
||||||
///
|
///
|
||||||
/// \return
|
/// \return
|
||||||
/// The number or arguments in this object.
|
/// The number or arguments in this object.
|
||||||
size_t GetArgumentCount() const;
|
size_t GetArgumentCount() const { return m_entries.size(); }
|
||||||
|
|
||||||
bool empty() const { return GetArgumentCount() == 0; }
|
bool empty() const { return GetArgumentCount() == 0; }
|
||||||
|
|
||||||
/// Gets the NULL terminated C string argument pointer for the argument at
|
/// Gets the NULL terminated C string argument pointer for the argument at
|
||||||
|
@ -252,9 +253,9 @@ public:
|
||||||
/// If the argument was originally quoted, put in the quote char here.
|
/// If the argument was originally quoted, put in the quote char here.
|
||||||
void Unshift(llvm::StringRef arg_str, char quote_char = '\0');
|
void Unshift(llvm::StringRef arg_str, char quote_char = '\0');
|
||||||
|
|
||||||
// Clear the arguments.
|
/// Clear the arguments.
|
||||||
//
|
///
|
||||||
// For re-setting or blanking out the list of arguments.
|
/// For re-setting or blanking out the list of arguments.
|
||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
static lldb::Encoding
|
static lldb::Encoding
|
||||||
|
@ -266,21 +267,20 @@ public:
|
||||||
static std::string GetShellSafeArgument(const FileSpec &shell,
|
static std::string GetShellSafeArgument(const FileSpec &shell,
|
||||||
llvm::StringRef unsafe_arg);
|
llvm::StringRef unsafe_arg);
|
||||||
|
|
||||||
// EncodeEscapeSequences will change the textual representation of common
|
/// EncodeEscapeSequences will change the textual representation of common
|
||||||
// escape sequences like "\n" (two characters) into a single '\n'. It does
|
/// escape sequences like "\n" (two characters) into a single '\n'. It does
|
||||||
// this for all of the supported escaped sequences and for the \0ooo (octal)
|
/// this for all of the supported escaped sequences and for the \0ooo (octal)
|
||||||
// and \xXX (hex). The resulting "dst" string will contain the character
|
/// and \xXX (hex). The resulting "dst" string will contain the character
|
||||||
// versions of all supported escape sequences. The common supported escape
|
/// versions of all supported escape sequences. The common supported escape
|
||||||
// sequences are: "\a", "\b", "\f", "\n", "\r", "\t", "\v", "\'", "\"", "\\".
|
/// sequences are: "\a", "\b", "\f", "\n", "\r", "\t", "\v", "\'", "\"", "\\".
|
||||||
|
|
||||||
static void EncodeEscapeSequences(const char *src, std::string &dst);
|
static void EncodeEscapeSequences(const char *src, std::string &dst);
|
||||||
|
|
||||||
// ExpandEscapeSequences will change a string of possibly non-printable
|
/// ExpandEscapeSequences will change a string of possibly non-printable
|
||||||
// characters and expand them into text. So '\n' will turn into two
|
/// characters and expand them into text. So '\n' will turn into two
|
||||||
// characters like "\n" which is suitable for human reading. When a character
|
/// characters like "\n" which is suitable for human reading. When a character
|
||||||
// is not printable and isn't one of the common in escape sequences listed in
|
/// is not printable and isn't one of the common in escape sequences listed in
|
||||||
// the help for EncodeEscapeSequences, then it will be encoded as octal.
|
/// the help for EncodeEscapeSequences, then it will be encoded as octal.
|
||||||
// Printable characters are left alone.
|
/// Printable characters are left alone.
|
||||||
static void ExpandEscapedCharacters(const char *src, std::string &dst);
|
static void ExpandEscapedCharacters(const char *src, std::string &dst);
|
||||||
|
|
||||||
static std::string EscapeLLDBCommandArgument(const std::string &arg,
|
static std::string EscapeLLDBCommandArgument(const std::string &arg,
|
||||||
|
@ -290,6 +290,10 @@ private:
|
||||||
friend struct llvm::yaml::MappingTraits<Args>;
|
friend struct llvm::yaml::MappingTraits<Args>;
|
||||||
|
|
||||||
std::vector<ArgEntry> m_entries;
|
std::vector<ArgEntry> m_entries;
|
||||||
|
/// The arguments as C strings with a trailing nullptr element.
|
||||||
|
///
|
||||||
|
/// These strings are owned by the ArgEntry object in m_entries with the
|
||||||
|
/// same index.
|
||||||
std::vector<char *> m_argv;
|
std::vector<char *> m_argv;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -256,8 +256,6 @@ void Args::SetCommandString(llvm::StringRef command) {
|
||||||
m_argv.push_back(nullptr);
|
m_argv.push_back(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t Args::GetArgumentCount() const { return m_entries.size(); }
|
|
||||||
|
|
||||||
const char *Args::GetArgumentAtIndex(size_t idx) const {
|
const char *Args::GetArgumentAtIndex(size_t idx) const {
|
||||||
if (idx < m_argv.size())
|
if (idx < m_argv.size())
|
||||||
return m_argv[idx];
|
return m_argv[idx];
|
||||||
|
|
Loading…
Reference in New Issue