[PATCH] D109408: [libcxxabi] NFC: fix incorrect indentation of braces
zhouyizhou via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 8 11:48:40 PDT 2021
zhouyizhou added a comment.
In D109408#2988417 <https://reviews.llvm.org/D109408#2988417>, @ldionne wrote:
> FWIW, I dislike that we don't indent stuff at all inside namespaces -- often I find it useful to indent things inside short-lived namespaces. But let's go for simplicity and consistency.
>
> Did you look into clang-formatting other files in libc++abi? What would the diff look like?
I take a general view of .cpp(.h) files in libc++abi, they are distributed in several directories. I do an experiment with
fuzz/cxa_demangle_fuzzer.cpp using clang-format, the result is as follows:
- cxa_demangle_fuzzer.cpp.orig 2021-09-09 02:19:17.117872938 +0800
+++ cxa_demangle_fuzzer.cpp 2021-09-09 02:19:34.845879852 +0800
@@ -1,15 +1,15 @@
-#include <stdint.h>
#include <stddef.h>
-#include <string.h>
+#include <stdint.h>
#include <stdlib.h>
-extern "C" char *
-__cxa_demangle(const char *mangled_name, char *buf, size_t *n, int *status);
+#include <string.h>
+extern "C" char *__cxa_demangle(const char *mangled_name, char *buf, size_t *n,
+ int *status);
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
- char *str = new char[size+1];
+ char *str = new char[size + 1];
memcpy(str, data, size);
str[size] = 0;
free(__cxa_demangle(str, 0, 0, 0));
- delete [] str;
+ delete[] str;
return 0;
}
As a beginner of LLVM and C++, I guess clang-formatting is meaningful ;-)
I guess we can clang-format a set of files at a time, and step-by-step clang-format all the .cpp(.h) files in libc++abi and fine-tune the results as how Quuxplusone did it ,
what's your opinion? If it is OK, I am very honored and pleased to do this work ;-)
Zhouyi
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D109408/new/
https://reviews.llvm.org/D109408
More information about the cfe-commits
mailing list