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
This commit is contained in:
Adrian Prantl
2018-04-30 16:49:04 +00:00
parent add59c052d
commit 05097246f3
604 changed files with 11186 additions and 13434 deletions

View File

@@ -132,8 +132,8 @@ const ModuleList &ModuleList::operator=(const ModuleList &rhs) {
// in thread A: | in thread B:
// x = y; | y = x;
//
// This establishes correct(same) lock taking order and thus
// avoids priority inversion.
// This establishes correct(same) lock taking order and thus avoids
// priority inversion.
if (uintptr_t(this) > uintptr_t(&rhs)) {
std::lock_guard<std::recursive_mutex> lhs_guard(m_modules_mutex);
std::lock_guard<std::recursive_mutex> rhs_guard(rhs.m_modules_mutex);
@@ -545,8 +545,8 @@ ModuleList::FindTypes(const SymbolContext &sc, const ConstString &name,
size_t total_matches = 0;
collection::const_iterator pos, end = m_modules.end();
if (sc.module_sp) {
// The symbol context "sc" contains a module so we want to search that
// one first if it is in our list...
// The symbol context "sc" contains a module so we want to search that one
// first if it is in our list...
for (pos = m_modules.begin(); pos != end; ++pos) {
if (sc.module_sp.get() == (*pos).get()) {
total_matches +=
@@ -563,8 +563,8 @@ ModuleList::FindTypes(const SymbolContext &sc, const ConstString &name,
SymbolContext world_sc;
for (pos = m_modules.begin(); pos != end; ++pos) {
// Search the module if the module is not equal to the one in the symbol
// context "sc". If "sc" contains a empty module shared pointer, then
// the comparison will always be true (valid_module_ptr != nullptr).
// context "sc". If "sc" contains a empty module shared pointer, then the
// comparison will always be true (valid_module_ptr != nullptr).
if (sc.module_sp.get() != (*pos).get())
total_matches +=
(*pos)->FindTypes(world_sc, name, name_is_fully_qualified,
@@ -791,8 +791,8 @@ Status ModuleList::GetSharedModule(const ModuleSpec &module_spec,
const ArchSpec &arch = module_spec.GetArchitecture();
// Make sure no one else can try and get or create a module while this
// function is actively working on it by doing an extra lock on the
// global mutex list.
// function is actively working on it by doing an extra lock on the global
// mutex list.
if (!always_create) {
ModuleList matching_module_list;
const size_t num_matching_modules =
@@ -815,8 +815,8 @@ Status ModuleList::GetSharedModule(const ModuleSpec &module_spec,
shared_module_list.Remove(module_sp);
module_sp.reset();
} else {
// The module matches and the module was not modified from
// when it was last loaded.
// The module matches and the module was not modified from when it
// was last loaded.
return error;
}
}
@@ -827,12 +827,12 @@ Status ModuleList::GetSharedModule(const ModuleSpec &module_spec,
return error;
module_sp.reset(new Module(module_spec));
// Make sure there are a module and an object file since we can specify
// a valid file path with an architecture that might not be in that file.
// By getting the object file we can guarantee that the architecture matches
// Make sure there are a module and an object file since we can specify a
// valid file path with an architecture that might not be in that file. By
// getting the object file we can guarantee that the architecture matches
if (module_sp->GetObjectFile()) {
// If we get in here we got the correct arch, now we just need
// to verify the UUID if one was given
// If we get in here we got the correct arch, now we just need to verify
// the UUID if one was given
if (uuid_ptr && *uuid_ptr != module_sp->GetUUID()) {
module_sp.reset();
} else {
@@ -871,8 +871,8 @@ Status ModuleList::GetSharedModule(const ModuleSpec &module_spec,
resolved_module_spec.GetFileSpec() = search_path_spec;
module_sp.reset(new Module(resolved_module_spec));
if (module_sp->GetObjectFile()) {
// If we get in here we got the correct arch, now we just need
// to verify the UUID if one was given
// If we get in here we got the correct arch, now we just need to
// verify the UUID if one was given
if (uuid_ptr && *uuid_ptr != module_sp->GetUUID()) {
module_sp.reset();
} else {
@@ -897,8 +897,8 @@ Status ModuleList::GetSharedModule(const ModuleSpec &module_spec,
// we now have to use more extreme measures to try and find the appropriate
// module.
// Fixup the incoming path in case the path points to a valid file, yet
// the arch or UUID (if one was passed in) don't match.
// Fixup the incoming path in case the path points to a valid file, yet the
// arch or UUID (if one was passed in) don't match.
ModuleSpec located_binary_modulespec =
Symbols::LocateExecutableObjectFile(module_spec);
@@ -935,8 +935,8 @@ Status ModuleList::GetSharedModule(const ModuleSpec &module_spec,
}
// Make sure no one else can try and get or create a module while this
// function is actively working on it by doing an extra lock on the
// global mutex list.
// function is actively working on it by doing an extra lock on the global
// mutex list.
ModuleSpec platform_module_spec(module_spec);
platform_module_spec.GetFileSpec() =
located_binary_modulespec.GetFileSpec();
@@ -967,8 +967,8 @@ Status ModuleList::GetSharedModule(const ModuleSpec &module_spec,
if (!module_sp) {
module_sp.reset(new Module(platform_module_spec));
// Make sure there are a module and an object file since we can specify
// a valid file path with an architecture that might not be in that file.
// Make sure there are a module and an object file since we can specify a
// valid file path with an architecture that might not be in that file.
// By getting the object file we can guarantee that the architecture
// matches
if (module_sp && module_sp->GetObjectFile()) {