Skip to content

Commit

Permalink
Reflow paragraphs in comments.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
adrian-prantl committed Apr 30, 2018
1 parent add59c0 commit 0509724
Show file tree
Hide file tree
Showing 604 changed files with 11,190 additions and 13,438 deletions.
6 changes: 3 additions & 3 deletions lldb/include/lldb/API/SBAddress.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ class LLDB_API SBAddress {
lldb::SBSymbolContext GetSymbolContext(uint32_t resolve_scope);

// The following functions grab individual objects for a given address and
// are less efficient if you want more than one symbol related objects.
// Use one of the following when you want multiple debug symbol related
// objects for an address:
// are less efficient if you want more than one symbol related objects. Use
// one of the following when you want multiple debug symbol related objects
// for an address:
// lldb::SBSymbolContext SBAddress::GetSymbolContext (uint32_t
// resolve_scope);
// lldb::SBSymbolContext SBTarget::ResolveSymbolContextForAddress (const
Expand Down
14 changes: 7 additions & 7 deletions lldb/include/lldb/API/SBBroadcaster.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@ class LLDB_API SBBroadcaster {
bool RemoveListener(const lldb::SBListener &listener,
uint32_t event_mask = UINT32_MAX);

// This comparison is checking if the internal opaque pointer value
// is equal to that in "rhs".
// This comparison is checking if the internal opaque pointer value is equal
// to that in "rhs".
bool operator==(const lldb::SBBroadcaster &rhs) const;

// This comparison is checking if the internal opaque pointer value
// is not equal to that in "rhs".
// This comparison is checking if the internal opaque pointer value is not
// equal to that in "rhs".
bool operator!=(const lldb::SBBroadcaster &rhs) const;

// This comparison is checking if the internal opaque pointer value
// is less than that in "rhs" so SBBroadcaster objects can be contained
// in ordered containers.
// This comparison is checking if the internal opaque pointer value is less
// than that in "rhs" so SBBroadcaster objects can be contained in ordered
// containers.
bool operator<(const lldb::SBBroadcaster &rhs) const;

protected:
Expand Down
31 changes: 14 additions & 17 deletions lldb/include/lldb/API/SBCommandInterpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,23 +138,20 @@ class SBCommandInterpreter {
lldb::SBCommandReturnObject result);

// The pointer based interface is not useful in SWIG, since the cursor &
// last_char arguments are string pointers INTO current_line
// and you can't do that in a scripting language interface in general...
// last_char arguments are string pointers INTO current_line and you can't do
// that in a scripting language interface in general...

// In either case, the way this works is that the you give it a line and
// cursor position in the line. The function
// will return the number of completions. The matches list will contain
// number_of_completions + 1 elements. The first
// element is the common substring after the cursor position for all the
// matches. The rest of the elements are the
// matches. The first element is useful if you are emulating the common shell
// behavior where the tab completes
// to the string that is common among all the matches, then you should first
// check if the first element is non-empty,
// cursor position in the line. The function will return the number of
// completions. The matches list will contain number_of_completions + 1
// elements. The first element is the common substring after the cursor
// position for all the matches. The rest of the elements are the matches.
// The first element is useful if you are emulating the common shell behavior
// where the tab completes to the string that is common among all the
// matches, then you should first check if the first element is non-empty,
// and if so just insert it and move the cursor to the end of the insertion.
// The next tab will return an empty
// common substring, and a list of choices (if any), at which point you should
// display the choices and let the user
// The next tab will return an empty common substring, and a list of choices
// (if any), at which point you should display the choices and let the user
// type further to disambiguate.

int HandleCompletion(const char *current_line, const char *cursor,
Expand All @@ -167,9 +164,9 @@ class SBCommandInterpreter {

bool WasInterrupted() const;

// Catch commands before they execute by registering a callback that will
// get called when the command gets executed. This allows GUI or command
// line interfaces to intercept a command and stop it from happening
// Catch commands before they execute by registering a callback that will get
// called when the command gets executed. This allows GUI or command line
// interfaces to intercept a command and stop it from happening
bool SetCommandOverrideCallback(const char *command_name,
lldb::CommandOverrideCallback callback,
void *baton);
Expand Down
3 changes: 1 addition & 2 deletions lldb/include/lldb/API/SBCommandReturnObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ class LLDB_API SBCommandReturnObject {

bool GetDescription(lldb::SBStream &description);

// deprecated, these two functions do not take
// ownership of file handle
// deprecated, these two functions do not take ownership of file handle
void SetImmediateOutputFile(FILE *fh);

void SetImmediateErrorFile(FILE *fh);
Expand Down
14 changes: 6 additions & 8 deletions lldb/include/lldb/API/SBData.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,10 @@ class LLDB_API SBData {
lldb::addr_t base_addr = LLDB_INVALID_ADDRESS);

// it would be nice to have SetData(SBError, const void*, size_t) when
// endianness and address size can be
// inferred from the existing DataExtractor, but having two SetData()
// signatures triggers a SWIG bug where
// the typemap isn't applied before resolving the overload, and thus the right
// function never gets called
// endianness and address size can be inferred from the existing
// DataExtractor, but having two SetData() signatures triggers a SWIG bug
// where the typemap isn't applied before resolving the overload, and thus
// the right function never gets called
void SetData(lldb::SBError &error, const void *buf, size_t size,
lldb::ByteOrder endian, uint8_t addr_size);

Expand All @@ -87,9 +86,8 @@ class LLDB_API SBData {
const char *data);

// in the following CreateData*() and SetData*() prototypes, the two
// parameters array and array_len
// should not be renamed or rearranged, because doing so will break the SWIG
// typemap
// parameters array and array_len should not be renamed or rearranged,
// because doing so will break the SWIG typemap
static lldb::SBData CreateDataFromUInt64Array(lldb::ByteOrder endian,
uint32_t addr_byte_size,
uint64_t *array,
Expand Down
6 changes: 2 additions & 4 deletions lldb/include/lldb/API/SBExpressionOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,8 @@ class LLDB_API SBExpressionOptions {
uint32_t GetOneThreadTimeoutInMicroSeconds() const;

// Set the timeout for running on one thread, 0 means use the default
// behavior.
// If you set this higher than the overall timeout, you'll get an error when
// you
// try to run the expression.
// behavior. If you set this higher than the overall timeout, you'll get an
// error when you try to run the expression.
void SetOneThreadTimeoutInMicroSeconds(uint32_t timeout = 0);

bool GetTryAllThreads() const;
Expand Down
8 changes: 4 additions & 4 deletions lldb/include/lldb/API/SBFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@ class LLDB_API SBFrame {
lldb::DynamicValueType use_dynamic);

// Find a value for a variable expression path like "rect.origin.x" or
// "pt_ptr->x", "*self", "*this->obj_ptr". The returned value is _not_
// and expression result and is not a constant object like
// SBFrame::EvaluateExpression(...) returns, but a child object of
// the variable value.
// "pt_ptr->x", "*self", "*this->obj_ptr". The returned value is _not_ and
// expression result and is not a constant object like
// SBFrame::EvaluateExpression(...) returns, but a child object of the
// variable value.
lldb::SBValue GetValueForVariablePath(const char *var_expr_cstr,
DynamicValueType use_dynamic);

Expand Down
3 changes: 1 addition & 2 deletions lldb/include/lldb/API/SBInstruction.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
#include <stdio.h>

// There's a lot to be fixed here, but need to wait for underlying insn
// implementation
// to be revised & settle down first.
// implementation to be revised & settle down first.

class InstructionImpl;

Expand Down
4 changes: 2 additions & 2 deletions lldb/include/lldb/API/SBInstructionList.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class LLDB_API SBInstructionList {
lldb::SBInstruction GetInstructionAtIndex(uint32_t idx);

// ----------------------------------------------------------------------
// Returns the number of instructions between the start and end address.
// If canSetBreakpoint is true then the count will be the number of
// Returns the number of instructions between the start and end address. If
// canSetBreakpoint is true then the count will be the number of
// instructions on which a breakpoint can be set.
// ----------------------------------------------------------------------
size_t GetInstructionsCount(const SBAddress &start,
Expand Down
8 changes: 4 additions & 4 deletions lldb/include/lldb/API/SBProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ class LLDB_API SBProcess {
lldb::SBThread GetSelectedThread() const;

//------------------------------------------------------------------
// Function for lazily creating a thread using the current OS
// plug-in. This function will be removed in the future when there
// are APIs to create SBThread objects through the interface and add
// them to the process through the SBProcess API.
// Function for lazily creating a thread using the current OS plug-in. This
// function will be removed in the future when there are APIs to create
// SBThread objects through the interface and add them to the process through
// the SBProcess API.
//------------------------------------------------------------------
lldb::SBThread CreateOSPluginThread(lldb::tid_t tid, lldb::addr_t context);

Expand Down
13 changes: 6 additions & 7 deletions lldb/include/lldb/API/SBStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,12 @@ class LLDB_API SBStream {

bool IsValid() const;

// If this stream is not redirected to a file, it will maintain a local
// cache for the stream data which can be accessed using this accessor.
// If this stream is not redirected to a file, it will maintain a local cache
// for the stream data which can be accessed using this accessor.
const char *GetData();

// If this stream is not redirected to a file, it will maintain a local
// cache for the stream output whose length can be accessed using this
// accessor.
// If this stream is not redirected to a file, it will maintain a local cache
// for the stream output whose length can be accessed using this accessor.
size_t GetSize();

void Printf(const char *format, ...) __attribute__((format(printf, 2, 3)));
Expand All @@ -44,8 +43,8 @@ class LLDB_API SBStream {
void RedirectToFileDescriptor(int fd, bool transfer_fh_ownership);

// If the stream is redirected to a file, forget about the file and if
// ownership of the file was transferred to this object, close the file.
// If the stream is backed by a local cache, clear this cache.
// ownership of the file was transferred to this object, close the file. If
// the stream is backed by a local cache, clear this cache.
void Clear();

protected:
Expand Down
4 changes: 2 additions & 2 deletions lldb/include/lldb/API/SBSymbol.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ class LLDB_API SBSymbol {
bool GetDescription(lldb::SBStream &description);

//----------------------------------------------------------------------
// Returns true if the symbol is externally visible in the module that
// it is defined in
// Returns true if the symbol is externally visible in the module that it is
// defined in
//----------------------------------------------------------------------
bool IsExternal();

Expand Down
7 changes: 3 additions & 4 deletions lldb/include/lldb/API/SBTarget.h
Original file line number Diff line number Diff line change
Expand Up @@ -775,8 +775,7 @@ class LLDB_API SBTarget {
const void *buf, size_t size);

// The "WithFlavor" is necessary to keep SWIG from getting confused about
// overloaded arguments when
// using the buf + size -> Python Object magic.
// overloaded arguments when using the buf + size -> Python Object magic.

lldb::SBInstructionList GetInstructionsWithFlavor(lldb::SBAddress base_addr,
const char *flavor_string,
Expand Down Expand Up @@ -829,8 +828,8 @@ class LLDB_API SBTarget {
friend class SBValue;

//------------------------------------------------------------------
// Constructors are private, use static Target::Create function to
// create an instance of this class.
// Constructors are private, use static Target::Create function to create an
// instance of this class.
//------------------------------------------------------------------

lldb::TargetSP GetSP() const;
Expand Down
3 changes: 1 addition & 2 deletions lldb/include/lldb/API/SBValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@ class LLDB_API SBValue {
lldb::SBType type);

// this has no address! GetAddress() and GetLoadAddress() as well as
// AddressOf()
// on the return of this call all return invalid
// AddressOf() on the return of this call all return invalid
lldb::SBValue CreateValueFromData(const char *name, lldb::SBData data,
lldb::SBType type);

Expand Down
4 changes: 2 additions & 2 deletions lldb/include/lldb/API/SBValueList.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class LLDB_API SBValueList {
const lldb::SBValueList &operator=(const lldb::SBValueList &rhs);

protected:
// only useful for visualizing the pointer or comparing two SBValueLists
// to see if they are backed by the same underlying Impl.
// only useful for visualizing the pointer or comparing two SBValueLists to
// see if they are backed by the same underlying Impl.
void *opaque_ptr();

private:
Expand Down
25 changes: 12 additions & 13 deletions lldb/include/lldb/Breakpoint/Breakpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ class Breakpoint : public std::enable_shared_from_this<Breakpoint>,
void Dump(Stream *s) override;

//------------------------------------------------------------------
// The next set of methods provide ways to tell the breakpoint to update
// it's location list - usually done when modules appear or disappear.
// The next set of methods provide ways to tell the breakpoint to update it's
// location list - usually done when modules appear or disappear.
//------------------------------------------------------------------

//------------------------------------------------------------------
Expand Down Expand Up @@ -287,8 +287,8 @@ class Breakpoint : public std::enable_shared_from_this<Breakpoint>,
lldb::ModuleSP new_module_sp);

//------------------------------------------------------------------
// The next set of methods provide access to the breakpoint locations
// for this breakpoint.
// The next set of methods provide access to the breakpoint locations for
// this breakpoint.
//------------------------------------------------------------------

//------------------------------------------------------------------
Expand Down Expand Up @@ -744,10 +744,10 @@ class Breakpoint : public std::enable_shared_from_this<Breakpoint>,
void DecrementIgnoreCount();

// BreakpointLocation::IgnoreCountShouldStop &
// Breakpoint::IgnoreCountShouldStop can only be called once per stop,
// and BreakpointLocation::IgnoreCountShouldStop should be tested first, and
// if it returns false we should
// continue, otherwise we should test Breakpoint::IgnoreCountShouldStop.
// Breakpoint::IgnoreCountShouldStop can only be called once per stop, and
// BreakpointLocation::IgnoreCountShouldStop should be tested first, and if
// it returns false we should continue, otherwise we should test
// Breakpoint::IgnoreCountShouldStop.

bool IgnoreCountShouldStop();

Expand All @@ -760,8 +760,7 @@ class Breakpoint : public std::enable_shared_from_this<Breakpoint>,

private:
// This one should only be used by Target to copy breakpoints from target to
// target - primarily from the dummy
// target to prime new targets.
// target - primarily from the dummy target to prime new targets.
Breakpoint(Target &new_target, Breakpoint &bp_to_copy_from);

//------------------------------------------------------------------
Expand All @@ -782,9 +781,9 @@ class Breakpoint : public std::enable_shared_from_this<Breakpoint>,
BreakpointPreconditionSP m_precondition_sp; // The precondition is a
// breakpoint-level hit filter
// that can be used
// to skip certain breakpoint hits. For instance, exception breakpoints
// use this to limit the stop to certain exception classes, while leaving
// the condition & callback free for user specification.
// to skip certain breakpoint hits. For instance, exception breakpoints use
// this to limit the stop to certain exception classes, while leaving the
// condition & callback free for user specification.
std::unique_ptr<BreakpointOptions>
m_options_up; // Settable breakpoint options
BreakpointLocationList
Expand Down
3 changes: 1 addition & 2 deletions lldb/include/lldb/Breakpoint/BreakpointLocation.h
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,7 @@ class BreakpointLocation
//------------------------------------------------------------------
// Constructors and Destructors
//
// Only the Breakpoint can make breakpoint locations, and it owns
// them.
// Only the Breakpoint can make breakpoint locations, and it owns them.
//------------------------------------------------------------------

//------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions lldb/include/lldb/Breakpoint/BreakpointLocationCollection.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ class BreakpointLocationCollection {

protected:
//------------------------------------------------------------------
// Classes that inherit from BreakpointLocationCollection can see
// and modify these
// Classes that inherit from BreakpointLocationCollection can see and modify
// these
//------------------------------------------------------------------

private:
Expand Down
12 changes: 5 additions & 7 deletions lldb/include/lldb/Breakpoint/BreakpointLocationList.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,11 @@ namespace lldb_private {
//----------------------------------------------------------------------

class BreakpointLocationList {
// Only Breakpoints can make the location list, or add elements to it.
// This is not just some random collection of locations. Rather, the act of
// adding the location
// to this list sets its ID, and implicitly all the locations have the same
// breakpoint ID as
// well. If you need a generic container for breakpoint locations, use
// BreakpointLocationCollection.
// Only Breakpoints can make the location list, or add elements to it. This
// is not just some random collection of locations. Rather, the act of
// adding the location to this list sets its ID, and implicitly all the
// locations have the same breakpoint ID as well. If you need a generic
// container for breakpoint locations, use BreakpointLocationCollection.
friend class Breakpoint;

public:
Expand Down
4 changes: 2 additions & 2 deletions lldb/include/lldb/Breakpoint/BreakpointName.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ class BreakpointName {
*this = Permissions();
}

// Merge the permissions from incoming into this set of permissions.
// Only merge set permissions, and most restrictive permission wins.
// Merge the permissions from incoming into this set of permissions. Only
// merge set permissions, and most restrictive permission wins.
void MergeInto(const Permissions &incoming)
{
MergePermission(incoming, listPerm);
Expand Down
Loading

0 comments on commit 0509724

Please sign in to comment.