[CodeFormat] Clang-format cpp sources (#4965)

Clang-format all c++ source files.
This commit is contained in:
sduzh
2020-11-28 18:36:49 +08:00
committed by GitHub
parent f944bf4d44
commit 6fedf5881b
1331 changed files with 62548 additions and 68514 deletions

View File

@ -25,9 +25,12 @@ namespace doris {
struct BfdFindCtx {
BfdFindCtx(bfd_symbol** syms_, bfd_vma pc_)
: found(false), syms(syms_), pc(pc_),
file_name(nullptr), func_name(nullptr), lineno(0) {
}
: found(false),
syms(syms_),
pc(pc_),
file_name(nullptr),
func_name(nullptr),
lineno(0) {}
bool found;
bfd_symbol** syms;
@ -70,8 +73,8 @@ static void find_addr_in_section(bfd* abfd, asection* sec, void* arg) {
if (ctx->pc >= vma + size) {
return;
}
ctx->found = bfd_find_nearest_line(
abfd, sec, ctx->syms, ctx->pc - vma, &ctx->file_name, &ctx->func_name, &ctx->lineno);
ctx->found = bfd_find_nearest_line(abfd, sec, ctx->syms, ctx->pc - vma, &ctx->file_name,
&ctx->func_name, &ctx->lineno);
}
static void section_print(bfd* bfd, asection* sec, void* arg) {
@ -129,12 +132,8 @@ void BfdParser::list_targets(std::vector<std::string>* out) {
free(targets);
}
BfdParser::BfdParser(const std::string& file_name)
: _file_name(file_name),
_abfd(nullptr),
_syms(nullptr),
_num_symbols(0),
_symbol_size(0) {
BfdParser::BfdParser(const std::string& file_name)
: _file_name(file_name), _abfd(nullptr), _syms(nullptr), _num_symbols(0), _symbol_size(0) {
if (!_is_bfd_inited) {
init_bfd();
}
@ -154,7 +153,7 @@ void BfdParser::list_sections(std::string* ss) {
bfd_map_over_sections(_abfd, section_print, (void*)ss);
}
static void list_matching_formats(char **p, std::string* message) {
static void list_matching_formats(char** p, std::string* message) {
if (!p || !*p) {
return;
}
@ -173,7 +172,7 @@ int BfdParser::open_bfd() {
}
if (bfd_check_format(_abfd, bfd_archive)) {
LOG(WARNING) << "bfd_check_format for archive failed because errmsg="
<< bfd_errmsg(bfd_get_error());
<< bfd_errmsg(bfd_get_error());
return -1;
}
@ -182,12 +181,12 @@ int BfdParser::open_bfd() {
if (bfd_get_error() == bfd_error_file_ambiguously_recognized) {
std::string message = _file_name;
list_matching_formats(matches, &message);
free (matches);
LOG(WARNING) << "bfd_check_format_matches failed because errmsg="
<< bfd_errmsg(bfd_get_error()) << " and " << message;
free(matches);
LOG(WARNING) << "bfd_check_format_matches failed because errmsg="
<< bfd_errmsg(bfd_get_error()) << " and " << message;
} else {
LOG(WARNING) << "bfd_check_format_matches failed because errmsg="
<< bfd_errmsg(bfd_get_error());
LOG(WARNING) << "bfd_check_format_matches failed because errmsg="
<< bfd_errmsg(bfd_get_error());
}
return -1;
}
@ -200,14 +199,13 @@ int BfdParser::load_symbols() {
// No need to load symbols;
return 0;
}
_num_symbols = bfd_read_minisymbols(_abfd, FALSE, (void **)&_syms, &_symbol_size);
_num_symbols = bfd_read_minisymbols(_abfd, FALSE, (void**)&_syms, &_symbol_size);
if (_num_symbols == 0) {
_num_symbols = bfd_read_minisymbols(_abfd, TRUE /* dynamic */,
(void **)&_syms, &_symbol_size);
_num_symbols =
bfd_read_minisymbols(_abfd, TRUE /* dynamic */, (void**)&_syms, &_symbol_size);
}
if (_num_symbols == 0) {
LOG(WARNING) << "Load symbols failed because errmsg="
<< bfd_errmsg(bfd_get_error());
LOG(WARNING) << "Load symbols failed because errmsg=" << bfd_errmsg(bfd_get_error());
return -1;
}
return 0;
@ -225,13 +223,12 @@ int BfdParser::parse() {
LOG(WARNING) << "Load symbols failed.";
return ret;
}
return 0;
}
int BfdParser::decode_address(const char* str, const char** end,
std::string* file_name, std::string* func_name,
unsigned int* lineno) {
int BfdParser::decode_address(const char* str, const char** end, std::string* file_name,
std::string* func_name, unsigned int* lineno) {
bfd_vma pc = bfd_scan_vma(str, end, 16);
BfdFindCtx ctx(_syms, pc);
@ -277,4 +274,4 @@ int BfdParser::decode_address(const char* str, const char** end,
#endif
}
}
} // namespace doris