Apply .clangformat to all repo source files

Change-Id: I7e79c6058f0303f9a98911e3b7dd2e8596079344


[ROCm/hip commit: 1ba06f63c4]
这个提交包含在:
Maneesh Gupta
2018-03-12 11:29:03 +05:30
父节点 52506ef382
当前提交 4f42ee762d
修改 293 个文件,包含 43980 行新增45830 行删除
+23 -27
查看文件
@@ -26,30 +26,30 @@ THE SOFTWARE.
//---
// Read environment variables.
void ihipReadEnv_I(int *var_ptr, const char *var_name1, const char *var_name2, const char *description)
{
char * env = getenv(var_name1);
void ihipReadEnv_I(int* var_ptr, const char* var_name1, const char* var_name2,
const char* description) {
char* env = getenv(var_name1);
// Check second name if first not defined, used to allow HIP_ or CUDA_ env vars.
if ((env == NULL) && strcmp(var_name2, "0")) {
env = getenv(var_name2);
}
// Default is set when variable is initialized (at top of this file), so only override if we find
// an environment variable.
// Default is set when variable is initialized (at top of this file), so only override if we
// find an environment variable.
if (env) {
long int v = strtol(env, NULL, 0);
*var_ptr = (int) (v);
*var_ptr = (int)(v);
}
if (HIP_PRINT_ENV) {
printf ("%-30s = %2d : %s\n", var_name1, *var_ptr, description);
printf("%-30s = %2d : %s\n", var_name1, *var_ptr, description);
}
}
void ihipReadEnv_S(std::string *var_ptr, const char *var_name1, const char *var_name2, const char *description)
{
char * env = getenv(var_name1);
void ihipReadEnv_S(std::string* var_ptr, const char* var_name1, const char* var_name2,
const char* description) {
char* env = getenv(var_name1);
// Check second name if first not defined, used to allow HIP_ or CUDA_ env vars.
if ((env == NULL) && strcmp(var_name2, "0")) {
@@ -60,14 +60,15 @@ void ihipReadEnv_S(std::string *var_ptr, const char *var_name1, const char *var_
*static_cast<std::string*>(var_ptr) = env;
}
if (HIP_PRINT_ENV) {
printf ("%-30s = %s : %s\n", var_name1, var_ptr->c_str(), description);
printf("%-30s = %s : %s\n", var_name1, var_ptr->c_str(), description);
}
}
void ihipReadEnv_Callback(void *var_ptr, const char *var_name1, const char *var_name2, const char *description, std::string (*setterCallback)(void * var_ptr, const char * env))
{
char * env = getenv(var_name1);
void ihipReadEnv_Callback(void* var_ptr, const char* var_name1, const char* var_name2,
const char* description,
std::string (*setterCallback)(void* var_ptr, const char* env)) {
char* env = getenv(var_name1);
// Check second name if first not defined, used to allow HIP_ or CUDA_ env vars.
if ((env == NULL) && strcmp(var_name2, "0")) {
@@ -79,35 +80,30 @@ void ihipReadEnv_Callback(void *var_ptr, const char *var_name1, const char *var_
var_string = setterCallback(var_ptr, env);
}
if (HIP_PRINT_ENV) {
printf ("%-30s = %s : %s\n", var_name1, var_string.c_str(), description);
printf("%-30s = %s : %s\n", var_name1, var_string.c_str(), description);
}
}
void tokenize(const std::string &s, char delim, std::vector<std::string> *tokens)
{
void tokenize(const std::string& s, char delim, std::vector<std::string>* tokens) {
std::stringstream ss;
ss.str(s);
std::string item;
while (getline(ss, item, delim)) {
item.erase (std::remove (item.begin(), item.end(), ' '), item.end()); // remove whitespace.
item.erase(std::remove(item.begin(), item.end(), ' '), item.end()); // remove whitespace.
tokens->push_back(item);
}
}
void trim(std::string *s)
{
void trim(std::string* s) {
// trim whitespace from beginning and end:
const char *t = "\t\n\r\f\v";
const char* t = "\t\n\r\f\v";
s->erase(0, s->find_first_not_of(t));
s->erase(s->find_last_not_of(t)+1);
s->erase(s->find_last_not_of(t) + 1);
}
static void ltrim(std::string *s)
{
static void ltrim(std::string* s) {
// trim whitespace from beginning
const char *t = "\t\n\r\f\v";
const char* t = "\t\n\r\f\v";
s->erase(0, s->find_first_not_of(t));
}