Reflow paragraphs in comments.
This is intended as a clean up after the big clang-format commit
(r280751), which unfortunately resulted in many of the comment
paragraphs in LLDB being very hard to read.
FYI, the script I used was:
import textwrap
import commands
import os
import sys
import re
tmp = "%s.tmp"%sys.argv[1]
out = open(tmp, "w+")
with open(sys.argv[1], "r") as f:
header = ""
text = ""
comment = re.compile(r'^( *//) ([^ ].*)$')
special = re.compile(r'^((([A-Z]+[: ])|([0-9]+ )).*)|(.*;)$')
for line in f:
match = comment.match(line)
if match and not special.match(match.group(2)):
# skip intentionally short comments.
if not text and len(match.group(2)) < 40:
out.write(line)
continue
if text:
text += " " + match.group(2)
else:
header = match.group(1)
text = match.group(2)
continue
if text:
filled = textwrap.wrap(text, width=(78-len(header)),
break_long_words=False)
for l in filled:
out.write(header+" "+l+'\n')
text = ""
out.write(line)
os.rename(tmp, sys.argv[1])
Differential Revision: https://reviews.llvm.org/D46144
llvm-svn: 331197
diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp
index 0ed2b51..e5d1f47 100644
--- a/lldb/source/Target/Platform.cpp
+++ b/lldb/source/Target/Platform.cpp
@@ -46,8 +46,8 @@
#include "llvm/Support/FileSystem.h"
-// Define these constants from POSIX mman.h rather than include the file
-// so that they will be correct even when compiled on Linux.
+// Define these constants from POSIX mman.h rather than include the file so
+// that they will be correct even when compiled on Linux.
#define MAP_PRIVATE 2
#define MAP_ANON 0x1000
@@ -56,8 +56,8 @@
static uint32_t g_initialize_count = 0;
-// Use a singleton function for g_local_platform_sp to avoid init
-// constructors since LLDB is often part of a shared library
+// Use a singleton function for g_local_platform_sp to avoid init constructors
+// since LLDB is often part of a shared library
static PlatformSP &GetHostPlatformSP() {
static PlatformSP g_platform_sp;
return g_platform_sp;
@@ -468,10 +468,9 @@
bool fetch = false;
if (success) {
- // We have valid OS version info, check to make sure it wasn't
- // manually set prior to connecting. If it was manually set prior
- // to connecting, then lets fetch the actual OS version info
- // if we are now connected.
+ // We have valid OS version info, check to make sure it wasn't manually
+ // set prior to connecting. If it was manually set prior to connecting,
+ // then lets fetch the actual OS version info if we are now connected.
if (is_connected && !m_os_version_set_while_connected)
fetch = true;
} else {
@@ -490,8 +489,8 @@
minor = m_minor_os_version;
update = m_update_os_version;
} else if (process) {
- // Check with the process in case it can answer the question if
- // a process was provided
+ // Check with the process in case it can answer the question if a process
+ // was provided
return process->GetHostOSVersion(major, minor, update);
}
return success;
@@ -578,8 +577,8 @@
// now recurse
std::string src_dir_path(src.GetPath());
- // Make a filespec that only fills in the directory of a FileSpec so
- // when we enumerate we can quickly fill in the filename for dst copies
+ // Make a filespec that only fills in the directory of a FileSpec so when
+ // we enumerate we can quickly fill in the filename for dst copies
FileSpec recurse_dst;
recurse_dst.GetDirectory().SetCString(dst_dir.GetPath().c_str());
RecurseCopyBaton rc_baton2 = {recurse_dst, rc_baton->platform_ptr,
@@ -657,9 +656,9 @@
if (first_dst_dir_char == '/' || first_dst_dir_char == '\\') {
fixed_dst.GetDirectory() = dst.GetDirectory();
}
- // If the fixed destination file doesn't have a directory yet,
- // then we must have a relative path. We will resolve this relative
- // path against the platform's working directory
+ // If the fixed destination file doesn't have a directory yet, then we
+ // must have a relative path. We will resolve this relative path against
+ // the platform's working directory
if (!fixed_dst.GetDirectory()) {
FileSpec relative_spec;
std::string path;
@@ -862,21 +861,19 @@
bool Platform::SetOSVersion(uint32_t major, uint32_t minor, uint32_t update) {
if (IsHost()) {
- // We don't need anyone setting the OS version for the host platform,
- // we should be able to figure it out by calling
- // HostInfo::GetOSVersion(...).
+ // We don't need anyone setting the OS version for the host platform, we
+ // should be able to figure it out by calling HostInfo::GetOSVersion(...).
return false;
} else {
- // We have a remote platform, allow setting the target OS version if
- // we aren't connected, since if we are connected, we should be able to
+ // We have a remote platform, allow setting the target OS version if we
+ // aren't connected, since if we are connected, we should be able to
// request the remote OS version from the connected platform.
if (IsConnected())
return false;
else {
- // We aren't connected and we might want to set the OS version
- // ahead of time before we connect so we can peruse files and
- // use a local SDK or PDK cache of support files to disassemble
- // or do other things.
+ // We aren't connected and we might want to set the OS version ahead of
+ // time before we connect so we can peruse files and use a local SDK or
+ // PDK cache of support files to disassemble or do other things.
m_major_os_version = major;
m_minor_os_version = minor;
m_update_os_version = update;
@@ -897,9 +894,9 @@
module_search_paths_ptr, nullptr,
nullptr);
} else {
- // No valid architecture was specified, ask the platform for
- // the architectures that we should be using (in the correct order)
- // and see if we can find a match that way
+ // No valid architecture was specified, ask the platform for the
+ // architectures that we should be using (in the correct order) and see
+ // if we can find a match that way
ModuleSpec arch_module_spec(module_spec);
for (uint32_t idx = 0; GetSupportedArchitectureAtIndex(
idx, arch_module_spec.GetArchitecture());
@@ -943,18 +940,17 @@
m_system_arch_set_while_connected = m_system_arch.IsValid();
}
} else {
- // We have a remote platform. We can only fetch the remote
- // system architecture if we are connected, and we don't want to do it
- // more than once.
+ // We have a remote platform. We can only fetch the remote system
+ // architecture if we are connected, and we don't want to do it more than
+ // once.
const bool is_connected = IsConnected();
bool fetch = false;
if (m_system_arch.IsValid()) {
- // We have valid OS version info, check to make sure it wasn't
- // manually set prior to connecting. If it was manually set prior
- // to connecting, then lets fetch the actual OS version info
- // if we are now connected.
+ // We have valid OS version info, check to make sure it wasn't manually
+ // set prior to connecting. If it was manually set prior to connecting,
+ // then lets fetch the actual OS version info if we are now connected.
if (is_connected && !m_system_arch_set_while_connected)
fetch = true;
} else {
@@ -1026,8 +1022,8 @@
bool Platform::GetProcessInfo(lldb::pid_t pid,
ProcessInstanceInfo &process_info) {
- // Take care of the host case so that each subclass can just
- // call this function to get the host functionality.
+ // Take care of the host case so that each subclass can just call this
+ // function to get the host functionality.
if (IsHost())
return Host::GetProcessInfo(pid, process_info);
return false;
@@ -1035,8 +1031,8 @@
uint32_t Platform::FindProcesses(const ProcessInstanceInfoMatch &match_info,
ProcessInstanceInfoList &process_infos) {
- // Take care of the host case so that each subclass can just
- // call this function to get the host functionality.
+ // Take care of the host case so that each subclass can just call this
+ // function to get the host functionality.
uint32_t match_count = 0;
if (IsHost())
match_count = Host::FindProcesses(match_info, process_infos);
@@ -1049,8 +1045,8 @@
if (log)
log->Printf("Platform::%s()", __FUNCTION__);
- // Take care of the host case so that each subclass can just
- // call this function to get the host functionality.
+ // Take care of the host case so that each subclass can just call this
+ // function to get the host functionality.
if (IsHost()) {
if (::getenv("LLDB_LAUNCH_FLAG_LAUNCH_IN_TTY"))
launch_info.GetFlags().Set(eLaunchFlagLaunchInTTY);
@@ -1107,8 +1103,7 @@
log->Printf("Platform::%s, pid %" PRIu64, __FUNCTION__, pid);
// Try to find a process plugin to handle this Kill request. If we can't,
- // fall back to
- // the default OS implementation.
+ // fall back to the default OS implementation.
size_t num_debuggers = Debugger::GetNumDebuggers();
for (size_t didx = 0; didx < num_debuggers; ++didx) {
DebuggerSP debugger = Debugger::GetDebuggerAtIndex(didx);
@@ -1143,23 +1138,22 @@
// Make sure we stop at the entry point
launch_info.GetFlags().Set(eLaunchFlagDebug);
// We always launch the process we are going to debug in a separate process
- // group, since then we can handle ^C interrupts ourselves w/o having to worry
- // about the target getting them as well.
+ // group, since then we can handle ^C interrupts ourselves w/o having to
+ // worry about the target getting them as well.
launch_info.SetLaunchInSeparateProcessGroup(true);
// Allow any StructuredData process-bound plugins to adjust the launch info
// if needed
size_t i = 0;
bool iteration_complete = false;
- // Note iteration can't simply go until a nullptr callback is returned, as
- // it is valid for a plugin to not supply a filter.
+ // Note iteration can't simply go until a nullptr callback is returned, as it
+ // is valid for a plugin to not supply a filter.
auto get_filter_func = PluginManager::GetStructuredDataFilterCallbackAtIndex;
for (auto filter_callback = get_filter_func(i, iteration_complete);
!iteration_complete;
filter_callback = get_filter_func(++i, iteration_complete)) {
if (filter_callback) {
- // Give this ProcessLaunchInfo filter a chance to adjust the launch
- // info.
+ // Give this ProcessLaunchInfo filter a chance to adjust the launch info.
error = (*filter_callback)(launch_info, target);
if (!error.Success()) {
if (log)
@@ -1192,10 +1186,10 @@
// process if this happens.
process_sp->SetShouldDetach(false);
- // If we didn't have any file actions, the pseudo terminal might
- // have been used where the slave side was given as the file to
- // open for stdin/out/err after we have already opened the master
- // so we can read/write stdin/out/err.
+ // If we didn't have any file actions, the pseudo terminal might have
+ // been used where the slave side was given as the file to open for
+ // stdin/out/err after we have already opened the master so we can
+ // read/write stdin/out/err.
int pty_fd = launch_info.GetPTY().ReleaseMasterFileDescriptor();
if (pty_fd != PseudoTerminal::invalid_fd) {
process_sp->SetSTDIOFileDescriptor(pty_fd);
@@ -1314,8 +1308,8 @@
offset += bytes_written;
if (bytes_written != bytes_read) {
- // We didn't write the correct number of bytes, so adjust
- // the file position in the source file we are reading from...
+ // We didn't write the correct number of bytes, so adjust the file
+ // position in the source file we are reading from...
source_file.SeekFromStart(offset);
}
}
@@ -1600,9 +1594,9 @@
if (module_spec.GetArchitecture().IsValid() == false) {
Status error;
- // No valid architecture was specified, ask the platform for
- // the architectures that we should be using (in the correct order)
- // and see if we can find a match that way
+ // No valid architecture was specified, ask the platform for the
+ // architectures that we should be using (in the correct order) and see if
+ // we can find a match that way
ModuleSpec arch_module_spec(module_spec);
for (uint32_t idx = 0; GetSupportedArchitectureAtIndex(
idx, arch_module_spec.GetArchitecture());
@@ -1853,8 +1847,8 @@
// TODO: support big-endian arm and thumb trap codes.
case llvm::Triple::arm: {
- // The ARM reference recommends the use of 0xe7fddefe and 0xdefe
- // but the linux kernel does otherwise.
+ // The ARM reference recommends the use of 0xe7fddefe and 0xdefe but the
+ // linux kernel does otherwise.
static const uint8_t g_arm_breakpoint_opcode[] = {0xf0, 0x01, 0xf0, 0xe7};
static const uint8_t g_thumb_breakpoint_opcode[] = {0x01, 0xde};