Skip to content

Commit cb11903

Browse files
committed
Fix formatting
1 parent 9fc0cb4 commit cb11903

File tree

5 files changed

+39
-31
lines changed

5 files changed

+39
-31
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_aix.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# include "sanitizer_posix.h"
2020

2121
struct prmap;
22-
typedef struct prmap prmap_t;
22+
typedef struct prmap prmap_t;
2323

2424
namespace __sanitizer {
2525

compiler-rt/lib/sanitizer_common/sanitizer_procmaps.h

+7-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,13 @@ class MemoryMappedSegment {
4040
public:
4141
explicit MemoryMappedSegment(char *buff = nullptr, uptr size = 0)
4242
: filename(buff), filename_size(size), data_(nullptr) {}
43-
explicit MemoryMappedSegment(char *buff, uptr size, char *display_buff, uptr display_size)
44-
: filename(buff), filename_size(size), displayname(display_buff),
45-
displayname_size(display_size), data_(nullptr) {}
43+
explicit MemoryMappedSegment(char *buff, uptr size, char *display_buff,
44+
uptr display_size)
45+
: filename(buff),
46+
filename_size(size),
47+
displayname(display_buff),
48+
displayname_size(display_size),
49+
data_(nullptr) {}
4650
~MemoryMappedSegment() {}
4751

4852
bool IsReadable() const { return protection & kProtectionRead; }

compiler-rt/lib/sanitizer_common/sanitizer_procmaps_aix.cpp

+14-12
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@
1313

1414
#if SANITIZER_AIX
1515
# include <assert.h>
16-
# include <stdlib.h>
1716
# include <stdio.h>
17+
# include <stdlib.h>
1818
# include <sys/procfs.h>
1919

2020
# include "sanitizer_common.h"
21-
# include "sanitizer_procmaps.h"
2221
# include "sanitizer_file.h"
22+
# include "sanitizer_procmaps.h"
2323

2424
namespace __sanitizer {
2525

26-
static int qsort_comp(const void *va, const void * vb) {
26+
static int qsort_comp(const void *va, const void *vb) {
2727
const prmap_t *a = (const prmap_t *)va;
2828
const prmap_t *b = (const prmap_t *)vb;
2929

@@ -37,12 +37,11 @@ static int qsort_comp(const void *va, const void * vb) {
3737
}
3838

3939
static prmap_t *SortProcMapEntries(char *buffer) {
40-
prmap_t *begin = (prmap_t*)buffer;
40+
prmap_t *begin = (prmap_t *)buffer;
4141
prmap_t *mapIter = begin;
4242
// The AIX procmap utility detects the end of the array of `prmap`s by finding
4343
// an entry where pr_size and pr_vaddr are both zero.
44-
while (mapIter->pr_size != 0 || mapIter->pr_vaddr != 0)
45-
++mapIter;
44+
while (mapIter->pr_size != 0 || mapIter->pr_vaddr != 0) ++mapIter;
4645
prmap_t *end = mapIter;
4746

4847
size_t count = end - begin;
@@ -57,7 +56,8 @@ void ReadProcMaps(ProcSelfMapsBuff *proc_maps) {
5756
constexpr unsigned BUFFER_SIZE = 128;
5857
char filenameBuf[BUFFER_SIZE] = {};
5958
internal_snprintf(filenameBuf, BUFFER_SIZE, "/proc/%d/map", pid);
60-
if (!ReadFileToBuffer(filenameBuf, &proc_maps->data, &proc_maps->mmaped_size, &proc_maps->len)) {
59+
if (!ReadFileToBuffer(filenameBuf, &proc_maps->data, &proc_maps->mmaped_size,
60+
&proc_maps->len)) {
6161
proc_maps->data = nullptr;
6262
proc_maps->mmaped_size = 0;
6363
proc_maps->len = 0;
@@ -106,15 +106,17 @@ bool MemoryMappingLayout::Next(MemoryMappedSegment *segment) {
106106
constexpr unsigned BUFFER_SIZE = 128;
107107
char objPath[BUFFER_SIZE] = {};
108108
// Use path /proc/<pid>/object/<object_id> to pass to the symbolizer.
109-
internal_snprintf(objPath, BUFFER_SIZE, "/proc/%d/object/%s", internal_getpid(), mapIter->pr_mapname);
109+
internal_snprintf(objPath, BUFFER_SIZE, "/proc/%d/object/%s",
110+
internal_getpid(), mapIter->pr_mapname);
110111
len = Min((uptr)internal_strlen(objPath), segment->filename_size - 1);
111112
internal_strncpy(segment->filename, objPath, len);
112113
segment->filename[len] = 0;
113114

114-
// We don't have the full path to user libraries, so we use what we have available as the
115-
// display name.
115+
// We don't have the full path to user libraries, so we use what we have
116+
// available as the display name.
116117
const char *displayPath = data_.proc_self_maps.data + mapIter->pr_pathoff;
117-
len = Min((uptr)internal_strlen(displayPath), segment->displayname_size - 1);
118+
len =
119+
Min((uptr)internal_strlen(displayPath), segment->displayname_size - 1);
118120
internal_strncpy(segment->displayname, displayPath, len);
119121
segment->displayname[len] = 0;
120122
} else if (segment->filename) {
@@ -126,7 +128,7 @@ bool MemoryMappingLayout::Next(MemoryMappedSegment *segment) {
126128
segment->offset = 0;
127129

128130
++mapIter;
129-
data_.current = (const char*)mapIter;
131+
data_.current = (const char *)mapIter;
130132

131133
return true;
132134
}

compiler-rt/lib/sanitizer_common/sanitizer_procmaps_common.cpp

+11-9
Original file line numberDiff line numberDiff line change
@@ -121,21 +121,23 @@ void MemoryMappingLayout::DumpListOfModules(
121121
InternalMmapVectorNoCtor<LoadedModule> *modules) {
122122
Reset();
123123
InternalMmapVector<char> module_name(kMaxPathLength);
124-
#if SANITIZER_AIX
124+
# if SANITIZER_AIX
125125
InternalMmapVector<char> module_displayname(kMaxPathLength);
126126
MemoryMappedSegment segment(module_name.data(), module_name.size(),
127-
module_displayname.data(), module_displayname.size());
128-
#else
127+
module_displayname.data(),
128+
module_displayname.size());
129+
# else
129130
MemoryMappedSegment segment(module_name.data(), module_name.size());
130-
#endif
131+
# endif
131132
for (uptr i = 0; Next(&segment); i++) {
132-
// On AIX, filename contains /proc/<pid>/object/<object_id> to pass to the symbolizer, so we use displayname to
133-
// contain the real path to present to users
134-
#if SANITIZER_AIX
133+
// On AIX, filename contains /proc/<pid>/object/<object_id> to pass to the
134+
// symbolizer, so we use displayname to contain the real path to present to
135+
// users
136+
# if SANITIZER_AIX
135137
const char *cur_name = segment.displayname;
136-
#else
138+
# else
137139
const char *cur_name = segment.filename;
138-
#endif
140+
# endif
139141
if (cur_name[0] == '\0')
140142
continue;
141143
// Don't subtract 'cur_beg' from the first entry:

compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -278,16 +278,16 @@ class LLVMSymbolizerProcess final : public SymbolizerProcess {
278278
const char* const kSymbolizerArch = "--default-arch=powerpc64";
279279
#elif defined(__powerpc64__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
280280
const char* const kSymbolizerArch = "--default-arch=powerpc64le";
281-
#elif defined(__powerpc__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
281+
# elif defined(__powerpc__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
282282
// Must check __powerpc__ after __powerpc64__ because both can be set.
283-
const char* const kSymbolizerArch = "--default-arch=powerpc";
284-
#elif defined(__s390x__)
283+
const char *const kSymbolizerArch = "--default-arch=powerpc";
284+
# elif defined(__s390x__)
285285
const char* const kSymbolizerArch = "--default-arch=s390x";
286-
#elif defined(__s390__)
286+
# elif defined(__s390__)
287287
const char* const kSymbolizerArch = "--default-arch=s390";
288-
#else
288+
# else
289289
const char* const kSymbolizerArch = "--default-arch=unknown";
290-
#endif
290+
# endif
291291

292292
const char *const demangle_flag =
293293
common_flags()->demangle ? "--demangle" : "--no-demangle";

0 commit comments

Comments
 (0)