Skip to content

Commit 8b3af63

Browse files
committedApr 10, 2019
[NFC] Remove ASCII lines from comments
A lot of comments in LLDB are surrounded by an ASCII line to delimit the begging and end of the comment. Its use is not really consistent across the code base, sometimes the lines are longer, sometimes they are shorter and sometimes they are omitted. Furthermore, it looks kind of weird with the 80 column limit, where the comment actually extends past the line, but not by much. Furthermore, when /// is used for Doxygen comments, it looks particularly odd. And when // is used, it incorrectly gives the impression that it's actually a Doxygen comment. I assume these lines were added to improve distinguishing between comments and code. However, given that todays editors and IDEs do a great job at highlighting comments, I think it's worth to drop this for the sake of consistency. The alternative is fixing all the inconsistencies, which would create a lot more churn. Differential revision: https://reviews.llvm.org/D60508 llvm-svn: 358135
1 parent 66b6bb1 commit 8b3af63

File tree

889 files changed

+0
-10287
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

889 files changed

+0
-10287
lines changed
 

‎lldb/examples/darwin/heap_find/heap/heap_find.cpp

-36
Original file line numberDiff line numberDiff line change
@@ -79,30 +79,24 @@
7979
// C++ includes
8080
#include <vector>
8181

82-
//----------------------------------------------------------------------
8382
// Redefine private types from "/usr/local/include/stack_logging.h"
84-
//----------------------------------------------------------------------
8583
typedef struct {
8684
uint32_t type_flags;
8785
uint64_t stack_identifier;
8886
uint64_t argument;
8987
mach_vm_address_t address;
9088
} mach_stack_logging_record_t;
9189

92-
//----------------------------------------------------------------------
9390
// Redefine private defines from "/usr/local/include/stack_logging.h"
94-
//----------------------------------------------------------------------
9591
#define stack_logging_type_free 0
9692
#define stack_logging_type_generic 1
9793
#define stack_logging_type_alloc 2
9894
#define stack_logging_type_dealloc 4
9995
// This bit is made up by this code
10096
#define stack_logging_type_vm_region 8
10197

102-
//----------------------------------------------------------------------
10398
// Redefine private function prototypes from
10499
// "/usr/local/include/stack_logging.h"
105-
//----------------------------------------------------------------------
106100
extern "C" kern_return_t __mach_stack_logging_set_file_path(task_t task,
107101
char *file_path);
108102

@@ -125,21 +119,15 @@ extern "C" void *gdb_class_getClass(void *objc_class);
125119
static void range_info_callback(task_t task, void *baton, unsigned type,
126120
uint64_t ptr_addr, uint64_t ptr_size);
127121

128-
//----------------------------------------------------------------------
129122
// Redefine private global variables prototypes from
130123
// "/usr/local/include/stack_logging.h"
131-
//----------------------------------------------------------------------
132124

133125
extern "C" int stack_logging_enable_logging;
134126

135-
//----------------------------------------------------------------------
136127
// Local defines
137-
//----------------------------------------------------------------------
138128
#define MAX_FRAMES 1024
139129

140-
//----------------------------------------------------------------------
141130
// Local Typedefs and Types
142-
//----------------------------------------------------------------------
143131
typedef void range_callback_t(task_t task, void *baton, unsigned type,
144132
uint64_t ptr_addr, uint64_t ptr_size);
145133
typedef void zone_callback_t(void *info, const malloc_zone_t *zone);
@@ -294,10 +282,8 @@ class MallocStackLoggingEntries {
294282
uint32_t m_size;
295283
};
296284

297-
//----------------------------------------------------------------------
298285
// A safe way to allocate memory and keep it from interfering with the
299286
// malloc enumerators.
300-
//----------------------------------------------------------------------
301287
void *safe_malloc(size_t n_bytes) {
302288
if (n_bytes > 0) {
303289
const int k_page_size = getpagesize();
@@ -311,9 +297,7 @@ void *safe_malloc(size_t n_bytes) {
311297
return NULL;
312298
}
313299

314-
//----------------------------------------------------------------------
315300
// ObjCClasses
316-
//----------------------------------------------------------------------
317301
class ObjCClasses {
318302
public:
319303
ObjCClasses() : m_objc_class_ptrs(NULL), m_size(0) {}
@@ -356,16 +340,12 @@ class ObjCClasses {
356340
uint32_t m_size;
357341
};
358342

359-
//----------------------------------------------------------------------
360343
// Local global variables
361-
//----------------------------------------------------------------------
362344
MatchResults g_matches;
363345
MallocStackLoggingEntries g_malloc_stack_history;
364346
ObjCClasses g_objc_classes;
365347

366-
//----------------------------------------------------------------------
367348
// ObjCClassInfo
368-
//----------------------------------------------------------------------
369349

370350
enum HeapInfoSortType { eSortTypeNone, eSortTypeBytes, eSortTypeCount };
371351

@@ -469,13 +449,11 @@ class ObjCClassInfo {
469449

470450
ObjCClassInfo g_objc_class_snapshot;
471451

472-
//----------------------------------------------------------------------
473452
// task_peek
474453
//
475454
// Reads memory from this tasks address space. This callback is needed
476455
// by the code that iterates through all of the malloc blocks to read
477456
// the memory in this process.
478-
//----------------------------------------------------------------------
479457
static kern_return_t task_peek(task_t task, vm_address_t remote_address,
480458
vm_size_t size, void **local_memory) {
481459
*local_memory = (void *)remote_address;
@@ -534,12 +512,10 @@ static const void foreach_zone_in_this_process(range_callback_info_t *info) {
534512
}
535513
}
536514

537-
//----------------------------------------------------------------------
538515
// dump_malloc_block_callback
539516
//
540517
// A simple callback that will dump each malloc block and all available
541518
// info from the enumeration callback perspective.
542-
//----------------------------------------------------------------------
543519
static void dump_malloc_block_callback(task_t task, void *baton, unsigned type,
544520
uint64_t ptr_addr, uint64_t ptr_size) {
545521
printf("task = 0x%4.4x: baton = %p, type = %u, ptr_addr = 0x%llx + 0x%llu\n",
@@ -739,12 +715,10 @@ malloc_stack_entry *get_stack_history_for_address(const void *addr,
739715
return g_malloc_stack_history.data();
740716
}
741717

742-
//----------------------------------------------------------------------
743718
// find_pointer_in_heap
744719
//
745720
// Finds a pointer value inside one or more currently valid malloc
746721
// blocks.
747-
//----------------------------------------------------------------------
748722
malloc_match *find_pointer_in_heap(const void *addr, int check_vm_regions) {
749723
g_matches.clear();
750724
// Setup "info" to look for a malloc block that contains data
@@ -767,12 +741,10 @@ malloc_match *find_pointer_in_heap(const void *addr, int check_vm_regions) {
767741
return g_matches.data();
768742
}
769743

770-
//----------------------------------------------------------------------
771744
// find_pointer_in_memory
772745
//
773746
// Finds a pointer value inside one or more currently valid malloc
774747
// blocks.
775-
//----------------------------------------------------------------------
776748
malloc_match *find_pointer_in_memory(uint64_t memory_addr, uint64_t memory_size,
777749
const void *addr) {
778750
g_matches.clear();
@@ -793,13 +765,11 @@ malloc_match *find_pointer_in_memory(uint64_t memory_addr, uint64_t memory_size,
793765
return g_matches.data();
794766
}
795767

796-
//----------------------------------------------------------------------
797768
// find_objc_objects_in_memory
798769
//
799770
// Find all instances of ObjC classes 'c', or all ObjC classes if 'c' is
800771
// NULL. If 'c' is non NULL, then also check objects to see if they
801772
// inherit from 'c'
802-
//----------------------------------------------------------------------
803773
malloc_match *find_objc_objects_in_memory(void *isa, int check_vm_regions) {
804774
g_matches.clear();
805775
if (g_objc_classes.Update()) {
@@ -819,12 +789,10 @@ malloc_match *find_objc_objects_in_memory(void *isa, int check_vm_regions) {
819789
return g_matches.data();
820790
}
821791

822-
//----------------------------------------------------------------------
823792
// get_heap_info
824793
//
825794
// Gather information for all allocations on the heap and report
826795
// statistics.
827-
//----------------------------------------------------------------------
828796

829797
void get_heap_info(int sort_type) {
830798
if (g_objc_classes.Update()) {
@@ -859,11 +827,9 @@ void get_heap_info(int sort_type) {
859827
}
860828
}
861829

862-
//----------------------------------------------------------------------
863830
// find_cstring_in_heap
864831
//
865832
// Finds a C string inside one or more currently valid malloc blocks.
866-
//----------------------------------------------------------------------
867833
malloc_match *find_cstring_in_heap(const char *s, int check_vm_regions) {
868834
g_matches.clear();
869835
if (s == NULL || s[0] == '\0') {
@@ -887,11 +853,9 @@ malloc_match *find_cstring_in_heap(const char *s, int check_vm_regions) {
887853
return g_matches.data();
888854
}
889855

890-
//----------------------------------------------------------------------
891856
// find_block_for_address
892857
//
893858
// Find the malloc block that whose address range contains "addr".
894-
//----------------------------------------------------------------------
895859
malloc_match *find_block_for_address(const void *addr, int check_vm_regions) {
896860
g_matches.clear();
897861
// Setup "info" to look for a malloc block that contains data

‎lldb/examples/functions/main.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929

3030
using namespace lldb;
3131

32-
//----------------------------------------------------------------------
3332
// This quick sample code shows how to create a debugger instance and
3433
// create an executable target without adding dependent shared
3534
// libraries. It will then set a regular expression breakpoint to get
@@ -47,7 +46,6 @@ using namespace lldb;
4746
//
4847
// $ DYLD_FRAMEWORK_PATH=/Volumes/data/lldb/tot/build/Debug ./a.out
4948
// executable_path1 [executable_path2 ...]
50-
//----------------------------------------------------------------------
5149
class LLDBSentry {
5250
public:
5351
LLDBSentry() {

0 commit comments

Comments
 (0)
Please sign in to comment.