diff options
| author | Jonas Devlieghere <jonas@devlieghere.com> | 2019-04-10 20:48:55 +0000 |
|---|---|---|
| committer | Jonas Devlieghere <jonas@devlieghere.com> | 2019-04-10 20:48:55 +0000 |
| commit | 8b3af63b8993e45b1783853a3fcf6f36bfbed81b (patch) | |
| tree | 41759d08361beda32b90e345d8033aecd2e15088 /lldb/examples/interposing | |
| parent | 66b6bb1766b3e5eea56b26fc91d03f1fccbe15e4 (diff) | |
| download | bcm5719-llvm-8b3af63b8993e45b1783853a3fcf6f36bfbed81b.tar.gz bcm5719-llvm-8b3af63b8993e45b1783853a3fcf6f36bfbed81b.zip | |
[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
Diffstat (limited to 'lldb/examples/interposing')
| -rw-r--r-- | lldb/examples/interposing/darwin/fd_interposing/FDInterposing.cpp | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/lldb/examples/interposing/darwin/fd_interposing/FDInterposing.cpp b/lldb/examples/interposing/darwin/fd_interposing/FDInterposing.cpp index efcb9bdfc07..e3f429cdf30 100644 --- a/lldb/examples/interposing/darwin/fd_interposing/FDInterposing.cpp +++ b/lldb/examples/interposing/darwin/fd_interposing/FDInterposing.cpp @@ -68,11 +68,9 @@ #include <unistd.h> #include <vector> -//---------------------------------------------------------------------- /// \def DISALLOW_COPY_AND_ASSIGN(TypeName) /// Macro definition for easily disallowing copy constructor and /// assignment operators in C++ classes. -//---------------------------------------------------------------------- #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ TypeName(const TypeName &); \ const TypeName &operator=(const TypeName &) @@ -87,10 +85,8 @@ int __open_extended(const char *, int, uid_t, gid_t, int, namespace fd_interposing { -//---------------------------------------------------------------------- // String class so we can get formatted strings without having to worry // about the memory storage since it will allocate the memory it needs. -//---------------------------------------------------------------------- class String { public: String() : m_str(NULL) {} @@ -142,23 +138,19 @@ private: DISALLOW_COPY_AND_ASSIGN(String); }; -//---------------------------------------------------------------------- // Type definitions -//---------------------------------------------------------------------- typedef std::vector<void *> Frames; class FDEvent; typedef std::vector<void *> Frames; typedef std::tr1::shared_ptr<FDEvent> FDEventSP; typedef std::tr1::shared_ptr<String> StringSP; -//---------------------------------------------------------------------- // FDEvent // // A class that describes a file desciptor event. // // File descriptor events fall into one of two categories: create events // and delete events. -//---------------------------------------------------------------------- class FDEvent { public: FDEvent(int fd, int err, const StringSP &string_sp, bool is_create, @@ -204,11 +196,9 @@ private: bool m_is_create; }; -//---------------------------------------------------------------------- // Templatized class that will save errno only if the "value" it is // constructed with is equal to INVALID. When the class goes out of // scope, it will restore errno if it was saved. -//---------------------------------------------------------------------- template <int INVALID> class Errno { public: // Save errno only if we are supposed to @@ -235,9 +225,7 @@ typedef Errno<-1> NegativeErrorErrno; typedef std::vector<FDEventSP> FDEventArray; typedef std::map<int, FDEventArray> FDEventMap; -//---------------------------------------------------------------------- // Globals -//---------------------------------------------------------------------- // Global event map that contains all file descriptor events. As file // descriptor create and close events come in, they will get filled // into this map (protected by g_mutex). When a file descriptor close @@ -264,10 +252,8 @@ static int g_compact = 1; // The current process ID static int g_pid = -1; static bool g_enabled = true; -//---------------------------------------------------------------------- // Mutex class that will lock a mutex when it is constructed, and unlock // it when is goes out of scope -//---------------------------------------------------------------------- class Locker { public: Locker(pthread_mutex_t *mutex_ptr) : m_mutex_ptr(mutex_ptr) { @@ -543,9 +529,7 @@ void save_backtrace(int fd, int err, const StringSP &string_sp, } } -//---------------------------------------------------------------------- // socket() interpose function -//---------------------------------------------------------------------- extern "C" int socket$__interposed__(int domain, int type, int protocol) { const int pid = get_interposed_pid(); if (pid >= 0) { @@ -572,9 +556,7 @@ extern "C" int socket$__interposed__(int domain, int type, int protocol) { } } -//---------------------------------------------------------------------- // socketpair() interpose function -//---------------------------------------------------------------------- extern "C" int socketpair$__interposed__(int domain, int type, int protocol, int fds[2]) { const int pid = get_interposed_pid(); @@ -600,9 +582,7 @@ extern "C" int socketpair$__interposed__(int domain, int type, int protocol, } } -//---------------------------------------------------------------------- // open() interpose function -//---------------------------------------------------------------------- extern "C" int open$__interposed__(const char *path, int oflag, int mode) { const int pid = get_interposed_pid(); if (pid >= 0) { @@ -631,9 +611,7 @@ extern "C" int open$__interposed__(const char *path, int oflag, int mode) { } } -//---------------------------------------------------------------------- // open$NOCANCEL() interpose function -//---------------------------------------------------------------------- extern "C" int open$NOCANCEL$__interposed__(const char *path, int oflag, int mode) { const int pid = get_interposed_pid(); @@ -654,9 +632,7 @@ extern "C" int open$NOCANCEL$__interposed__(const char *path, int oflag, } } -//---------------------------------------------------------------------- // __open_extended() interpose function -//---------------------------------------------------------------------- extern "C" int __open_extended$__interposed__(const char *path, int oflag, uid_t uid, gid_t gid, int mode, struct kauth_filesec *fsacl) { @@ -679,9 +655,7 @@ extern "C" int __open_extended$__interposed__(const char *path, int oflag, } } -//---------------------------------------------------------------------- // kqueue() interpose function -//---------------------------------------------------------------------- extern "C" int kqueue$__interposed__(void) { const int pid = get_interposed_pid(); if (pid >= 0) { @@ -699,9 +673,7 @@ extern "C" int kqueue$__interposed__(void) { } } -//---------------------------------------------------------------------- // shm_open() interpose function -//---------------------------------------------------------------------- extern "C" int shm_open$__interposed__(const char *path, int oflag, int mode) { const int pid = get_interposed_pid(); if (pid >= 0) { @@ -721,9 +693,7 @@ extern "C" int shm_open$__interposed__(const char *path, int oflag, int mode) { } } -//---------------------------------------------------------------------- // accept() interpose function -//---------------------------------------------------------------------- extern "C" int accept$__interposed__(int socket, struct sockaddr *address, socklen_t *address_len) { const int pid = get_interposed_pid(); @@ -743,9 +713,7 @@ extern "C" int accept$__interposed__(int socket, struct sockaddr *address, } } -//---------------------------------------------------------------------- // accept$NOCANCEL() interpose function -//---------------------------------------------------------------------- extern "C" int accept$NOCANCEL$__interposed__(int socket, struct sockaddr *address, socklen_t *address_len) { @@ -766,9 +734,7 @@ extern "C" int accept$NOCANCEL$__interposed__(int socket, } } -//---------------------------------------------------------------------- // dup() interpose function -//---------------------------------------------------------------------- extern "C" int dup$__interposed__(int fd2) { const int pid = get_interposed_pid(); if (pid >= 0) { @@ -787,9 +753,7 @@ extern "C" int dup$__interposed__(int fd2) { } } -//---------------------------------------------------------------------- // dup2() interpose function -//---------------------------------------------------------------------- extern "C" int dup2$__interposed__(int fd1, int fd2) { const int pid = get_interposed_pid(); if (pid >= 0) { @@ -819,9 +783,7 @@ extern "C" int dup2$__interposed__(int fd1, int fd2) { } } -//---------------------------------------------------------------------- // close() interpose function -//---------------------------------------------------------------------- extern "C" int close$__interposed__(int fd) { const int pid = get_interposed_pid(); if (pid >= 0) { @@ -859,9 +821,7 @@ extern "C" int close$__interposed__(int fd) { } } -//---------------------------------------------------------------------- // close$NOCANCEL() interpose function -//---------------------------------------------------------------------- extern "C" int close$NOCANCEL$__interposed__(int fd) { const int pid = get_interposed_pid(); if (pid >= 0) { @@ -900,9 +860,7 @@ extern "C" int close$NOCANCEL$__interposed__(int fd) { } } -//---------------------------------------------------------------------- // pipe() interpose function -//---------------------------------------------------------------------- extern "C" int pipe$__interposed__(int fds[2]) { const int pid = get_interposed_pid(); if (pid >= 0) { @@ -926,7 +884,6 @@ extern "C" int pipe$__interposed__(int fds[2]) { } } -//---------------------------------------------------------------------- // get_fd_history() // // This function allows runtime access to the file descriptor history. @@ -936,7 +893,6 @@ extern "C" int pipe$__interposed__(int fds[2]) { // // @param[in] fd // The file descriptor whose history should be dumped -//---------------------------------------------------------------------- extern "C" void get_fd_history(int log_fd, int fd) { // "create" below needs to be outside of the mutex locker scope if (log_fd >= 0) { @@ -960,9 +916,7 @@ extern "C" void get_fd_history(int log_fd, int fd) { } } -//---------------------------------------------------------------------- // Interposing -//---------------------------------------------------------------------- // FD creation routines DYLD_INTERPOSE(accept$__interposed__, accept); DYLD_INTERPOSE(accept$NOCANCEL$__interposed__, accept$NOCANCEL); |

