diff options
author | Dean Michael Berris <dberris@google.com> | 2017-02-07 23:35:34 +0000 |
---|---|---|
committer | Dean Michael Berris <dberris@google.com> | 2017-02-07 23:35:34 +0000 |
commit | 9a050b3e83389c8962f3baa55097578bf1f3c49f (patch) | |
tree | 35e6082aff9debca0cd28958b0095be0138dad42 | |
parent | 95db1de9d8da0b4caddb3ad5c35959118864f58b (diff) |
[XRay][compiler-rt][NFC] Turn ProudCase functions to humbleCase functions
Summary:
As pointed out in casual reading of the XRay codebase, that we had
some interesting named functions that didn't quite follow the LLVM coding
conventions.
Reviewers: chandlerc, dblaikie
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D29625
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@294373 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/xray/tests/unit/fdr_logging_test.cc | 24 | ||||
-rw-r--r-- | lib/xray/xray_arm.cc | 8 | ||||
-rw-r--r-- | lib/xray/xray_fdr_logging.cc | 18 | ||||
-rw-r--r-- | lib/xray/xray_fdr_logging.h | 10 | ||||
-rw-r--r-- | lib/xray/xray_flags.cc | 10 | ||||
-rw-r--r-- | lib/xray/xray_flags.h | 4 | ||||
-rw-r--r-- | lib/xray/xray_init.cc | 2 | ||||
-rw-r--r-- | lib/xray/xray_interface.cc | 12 | ||||
-rw-r--r-- | lib/xray/xray_utils.cc | 4 | ||||
-rw-r--r-- | lib/xray/xray_utils.h | 2 |
10 files changed, 47 insertions, 47 deletions
diff --git a/lib/xray/tests/unit/fdr_logging_test.cc b/lib/xray/tests/unit/fdr_logging_test.cc index 34366927f..a1a6155fe 100644 --- a/lib/xray/tests/unit/fdr_logging_test.cc +++ b/lib/xray/tests/unit/fdr_logging_test.cc @@ -50,14 +50,14 @@ TEST(FDRLoggingTest, Simple) { char TmpFilename[] = "fdr-logging-test.XXXXXX"; Options.Fd = mkstemp(TmpFilename); ASSERT_NE(Options.Fd, -1); - ASSERT_EQ(FDRLogging_init(kBufferSize, kBufferMax, &Options, + ASSERT_EQ(fdrLoggingInit(kBufferSize, kBufferMax, &Options, sizeof(FDRLoggingOptions)), XRayLogInitStatus::XRAY_LOG_INITIALIZED); - FDRLogging_handleArg0(1, XRayEntryType::ENTRY); - FDRLogging_handleArg0(1, XRayEntryType::EXIT); - ASSERT_EQ(FDRLogging_finalize(), XRayLogInitStatus::XRAY_LOG_FINALIZED); - ASSERT_EQ(FDRLogging_flush(), XRayLogFlushStatus::XRAY_LOG_FLUSHED); - ASSERT_EQ(FDRLogging_reset(), XRayLogInitStatus::XRAY_LOG_UNINITIALIZED); + fdrLoggingHandleArg0(1, XRayEntryType::ENTRY); + fdrLoggingHandleArg0(1, XRayEntryType::EXIT); + ASSERT_EQ(fdrLoggingFinalize(), XRayLogInitStatus::XRAY_LOG_FINALIZED); + ASSERT_EQ(fdrLoggingFlush(), XRayLogFlushStatus::XRAY_LOG_FLUSHED); + ASSERT_EQ(fdrLoggingReset(), XRayLogInitStatus::XRAY_LOG_UNINITIALIZED); // To do this properly, we have to close the file descriptor then re-open the // file for reading this time. @@ -89,16 +89,16 @@ TEST(FDRLoggingTest, Multiple) { char TmpFilename[] = "fdr-logging-test.XXXXXX"; Options.Fd = mkstemp(TmpFilename); ASSERT_NE(Options.Fd, -1); - ASSERT_EQ(FDRLogging_init(kBufferSize, kBufferMax, &Options, + ASSERT_EQ(fdrLoggingInit(kBufferSize, kBufferMax, &Options, sizeof(FDRLoggingOptions)), XRayLogInitStatus::XRAY_LOG_INITIALIZED); for (uint64_t I = 0; I < 100; ++I) { - FDRLogging_handleArg0(1, XRayEntryType::ENTRY); - FDRLogging_handleArg0(1, XRayEntryType::EXIT); + fdrLoggingHandleArg0(1, XRayEntryType::ENTRY); + fdrLoggingHandleArg0(1, XRayEntryType::EXIT); } - ASSERT_EQ(FDRLogging_finalize(), XRayLogInitStatus::XRAY_LOG_FINALIZED); - ASSERT_EQ(FDRLogging_flush(), XRayLogFlushStatus::XRAY_LOG_FLUSHED); - ASSERT_EQ(FDRLogging_reset(), XRayLogInitStatus::XRAY_LOG_UNINITIALIZED); + ASSERT_EQ(fdrLoggingFinalize(), XRayLogInitStatus::XRAY_LOG_FINALIZED); + ASSERT_EQ(fdrLoggingFlush(), XRayLogFlushStatus::XRAY_LOG_FLUSHED); + ASSERT_EQ(fdrLoggingReset(), XRayLogInitStatus::XRAY_LOG_UNINITIALIZED); // To do this properly, we have to close the file descriptor then re-open the // file for reading this time. diff --git a/lib/xray/xray_arm.cc b/lib/xray/xray_arm.cc index 73e9b4111..3ed82b337 100644 --- a/lib/xray/xray_arm.cc +++ b/lib/xray/xray_arm.cc @@ -74,7 +74,7 @@ write32bitLoadReg(uint8_t regNo, uint32_t *Address, // MOVW r0, #<lower 16 bits of the |Value|> // MOVT r0, #<higher 16 bits of the |Value|> inline static uint32_t * -Write32bitLoadR0(uint32_t *Address, +write32bitLoadR0(uint32_t *Address, const uint32_t Value) XRAY_NEVER_INSTRUMENT { return write32bitLoadReg(0, Address, Value); } @@ -83,7 +83,7 @@ Write32bitLoadR0(uint32_t *Address, // MOVW ip, #<lower 16 bits of the |Value|> // MOVT ip, #<higher 16 bits of the |Value|> inline static uint32_t * -Write32bitLoadIP(uint32_t *Address, +write32bitLoadIP(uint32_t *Address, const uint32_t Value) XRAY_NEVER_INSTRUMENT { return write32bitLoadReg(12, Address, Value); } @@ -121,9 +121,9 @@ inline static bool patchSled(const bool Enable, const uint32_t FuncId, uint32_t *CurAddress = FirstAddress + 1; if (Enable) { CurAddress = - Write32bitLoadR0(CurAddress, reinterpret_cast<uint32_t>(FuncId)); + write32bitLoadR0(CurAddress, reinterpret_cast<uint32_t>(FuncId)); CurAddress = - Write32bitLoadIP(CurAddress, reinterpret_cast<uint32_t>(TracingHook)); + write32bitLoadIP(CurAddress, reinterpret_cast<uint32_t>(TracingHook)); *CurAddress = uint32_t(PatchOpcodes::PO_BlxIp); CurAddress++; *CurAddress = uint32_t(PatchOpcodes::PO_PopR0Lr); diff --git a/lib/xray/xray_fdr_logging.cc b/lib/xray/xray_fdr_logging.cc index dd88df194..d08013171 100644 --- a/lib/xray/xray_fdr_logging.cc +++ b/lib/xray/xray_fdr_logging.cc @@ -55,7 +55,7 @@ std::atomic<XRayLogFlushStatus> LogFlushStatus{ std::unique_ptr<FDRLoggingOptions> FDROptions; -XRayLogInitStatus FDRLogging_init(std::size_t BufferSize, std::size_t BufferMax, +XRayLogInitStatus fdrLoggingInit(std::size_t BufferSize, std::size_t BufferMax, void *Options, size_t OptionsSize) XRAY_NEVER_INSTRUMENT { assert(OptionsSize == sizeof(FDRLoggingOptions)); @@ -68,7 +68,7 @@ XRayLogInitStatus FDRLogging_init(std::size_t BufferSize, std::size_t BufferMax, FDROptions.reset(new FDRLoggingOptions()); *FDROptions = *reinterpret_cast<FDRLoggingOptions *>(Options); if (FDROptions->ReportErrors) - SetPrintfAndReportCallback(PrintToStdErr); + SetPrintfAndReportCallback(printToStdErr); bool Success = false; BQ = std::make_shared<BufferQueue>(BufferSize, BufferMax, Success); @@ -78,7 +78,7 @@ XRayLogInitStatus FDRLogging_init(std::size_t BufferSize, std::size_t BufferMax, } // Install the actual handleArg0 handler after initialising the buffers. - __xray_set_handler(FDRLogging_handleArg0); + __xray_set_handler(fdrLoggingHandleArg0); LoggingStatus.store(XRayLogInitStatus::XRAY_LOG_INITIALIZED, std::memory_order_release); @@ -86,7 +86,7 @@ XRayLogInitStatus FDRLogging_init(std::size_t BufferSize, std::size_t BufferMax, } // Must finalize before flushing. -XRayLogFlushStatus FDRLogging_flush() XRAY_NEVER_INSTRUMENT { +XRayLogFlushStatus fdrLoggingFlush() XRAY_NEVER_INSTRUMENT { if (LoggingStatus.load(std::memory_order_acquire) != XRayLogInitStatus::XRAY_LOG_FINALIZED) return XRayLogFlushStatus::XRAY_LOG_NOT_FLUSHING; @@ -142,7 +142,7 @@ XRayLogFlushStatus FDRLogging_flush() XRAY_NEVER_INSTRUMENT { return XRayLogFlushStatus::XRAY_LOG_FLUSHED; } -XRayLogInitStatus FDRLogging_finalize() XRAY_NEVER_INSTRUMENT { +XRayLogInitStatus fdrLoggingFinalize() XRAY_NEVER_INSTRUMENT { XRayLogInitStatus CurrentStatus = XRayLogInitStatus::XRAY_LOG_INITIALIZED; if (!LoggingStatus.compare_exchange_strong( CurrentStatus, XRayLogInitStatus::XRAY_LOG_FINALIZING, @@ -158,7 +158,7 @@ XRayLogInitStatus FDRLogging_finalize() XRAY_NEVER_INSTRUMENT { return XRayLogInitStatus::XRAY_LOG_FINALIZED; } -XRayLogInitStatus FDRLogging_reset() XRAY_NEVER_INSTRUMENT { +XRayLogInitStatus fdrLoggingReset() XRAY_NEVER_INSTRUMENT { XRayLogInitStatus CurrentStatus = XRayLogInitStatus::XRAY_LOG_FINALIZED; if (!LoggingStatus.compare_exchange_strong( CurrentStatus, XRayLogInitStatus::XRAY_LOG_UNINITIALIZED, @@ -325,7 +325,7 @@ inline bool loggingInitialized() { } // namespace -void FDRLogging_handleArg0(int32_t FuncId, +void fdrLoggingHandleArg0(int32_t FuncId, XRayEntryType Entry) XRAY_NEVER_INSTRUMENT { // We want to get the TSC as early as possible, so that we can check whether // we've seen this CPU before. We also do it before we load anything else, to @@ -534,8 +534,8 @@ static auto Unused = [] { using namespace __xray; if (flags()->xray_fdr_log) { XRayLogImpl Impl{ - FDRLogging_init, FDRLogging_finalize, FDRLogging_handleArg0, - FDRLogging_flush, + fdrLoggingInit, fdrLoggingFinalize, fdrLoggingHandleArg0, + fdrLoggingFlush, }; __xray_set_log_impl(Impl); } diff --git a/lib/xray/xray_fdr_logging.h b/lib/xray/xray_fdr_logging.h index 8dd55d5c6..cade135e3 100644 --- a/lib/xray/xray_fdr_logging.h +++ b/lib/xray/xray_fdr_logging.h @@ -83,12 +83,12 @@ struct FDRLoggingOptions { }; // Flight Data Recorder mode implementation interfaces. -XRayLogInitStatus FDRLogging_init(size_t BufferSize, size_t BufferMax, +XRayLogInitStatus fdrLoggingInit(size_t BufferSize, size_t BufferMax, void *Options, size_t OptionsSize); -XRayLogInitStatus FDRLogging_finalize(); -void FDRLogging_handleArg0(int32_t FuncId, XRayEntryType Entry); -XRayLogFlushStatus FDRLogging_flush(); -XRayLogInitStatus FDRLogging_reset(); +XRayLogInitStatus fdrLoggingFinalize(); +void fdrLoggingHandleArg0(int32_t FuncId, XRayEntryType Entry); +XRayLogFlushStatus fdrLoggingFlush(); +XRayLogInitStatus fdrLoggingReset(); } // namespace __xray diff --git a/lib/xray/xray_flags.cc b/lib/xray/xray_flags.cc index 338c2378b..7465cb439 100644 --- a/lib/xray/xray_flags.cc +++ b/lib/xray/xray_flags.cc @@ -24,26 +24,26 @@ namespace __xray { Flags xray_flags_dont_use_directly; // use via flags(). -void Flags::SetDefaults() XRAY_NEVER_INSTRUMENT { +void Flags::setDefaults() XRAY_NEVER_INSTRUMENT { #define XRAY_FLAG(Type, Name, DefaultValue, Description) Name = DefaultValue; #include "xray_flags.inc" #undef XRAY_FLAG } -static void RegisterXRayFlags(FlagParser *P, Flags *F) XRAY_NEVER_INSTRUMENT { +static void registerXRayFlags(FlagParser *P, Flags *F) XRAY_NEVER_INSTRUMENT { #define XRAY_FLAG(Type, Name, DefaultValue, Description) \ RegisterFlag(P, #Name, Description, &F->Name); #include "xray_flags.inc" #undef XRAY_FLAG } -void InitializeFlags() XRAY_NEVER_INSTRUMENT { +void initializeFlags() XRAY_NEVER_INSTRUMENT { SetCommonFlagsDefaults(); auto *F = flags(); - F->SetDefaults(); + F->setDefaults(); FlagParser XRayParser; - RegisterXRayFlags(&XRayParser, F); + registerXRayFlags(&XRayParser, F); RegisterCommonFlags(&XRayParser); // Override from command line. diff --git a/lib/xray/xray_flags.h b/lib/xray/xray_flags.h index 2ecf5fb9b..f4e30283b 100644 --- a/lib/xray/xray_flags.h +++ b/lib/xray/xray_flags.h @@ -24,13 +24,13 @@ struct Flags { #include "xray_flags.inc" #undef XRAY_FLAG - void SetDefaults(); + void setDefaults(); }; extern Flags xray_flags_dont_use_directly; inline Flags *flags() { return &xray_flags_dont_use_directly; } -void InitializeFlags(); +void initializeFlags(); } // namespace __xray diff --git a/lib/xray/xray_init.cc b/lib/xray/xray_init.cc index eb8618291..9d012e9a6 100644 --- a/lib/xray/xray_init.cc +++ b/lib/xray/xray_init.cc @@ -46,7 +46,7 @@ std::atomic<__xray::XRaySledMap> XRayInstrMap{}; // __xray_init() will do the actual loading of the current process' memory map // and then proceed to look for the .xray_instr_map section/segment. void __xray_init() XRAY_NEVER_INSTRUMENT { - InitializeFlags(); + initializeFlags(); if (__start_xray_instr_map == nullptr) { Report("XRay instrumentation map missing. Not initializing XRay.\n"); return; diff --git a/lib/xray/xray_interface.cc b/lib/xray/xray_interface.cc index 20a2b66c4..0b13983e5 100644 --- a/lib/xray/xray_interface.cc +++ b/lib/xray/xray_interface.cc @@ -115,14 +115,14 @@ public: }; template <class Function> -CleanupInvoker<Function> ScopeCleanup(Function Fn) XRAY_NEVER_INSTRUMENT { +CleanupInvoker<Function> scopeCleanup(Function Fn) XRAY_NEVER_INSTRUMENT { return CleanupInvoker<Function>{Fn}; } -// ControlPatching implements the common internals of the patching/unpatching +// controlPatching implements the common internals of the patching/unpatching // implementation. |Enable| defines whether we're enabling or disabling the // runtime XRay instrumentation. -XRayPatchingStatus ControlPatching(bool Enable) XRAY_NEVER_INSTRUMENT { +XRayPatchingStatus controlPatching(bool Enable) XRAY_NEVER_INSTRUMENT { if (!XRayInitialized.load(std::memory_order_acquire)) return XRayPatchingStatus::NOT_INITIALIZED; // Not initialized. @@ -134,7 +134,7 @@ XRayPatchingStatus ControlPatching(bool Enable) XRAY_NEVER_INSTRUMENT { } bool PatchingSuccess = false; - auto XRayPatchingStatusResetter = ScopeCleanup([&PatchingSuccess] { + auto XRayPatchingStatusResetter = scopeCleanup([&PatchingSuccess] { if (!PatchingSuccess) { XRayPatching.store(false, std::memory_order_release); } @@ -199,9 +199,9 @@ XRayPatchingStatus ControlPatching(bool Enable) XRAY_NEVER_INSTRUMENT { } XRayPatchingStatus __xray_patch() XRAY_NEVER_INSTRUMENT { - return ControlPatching(true); + return controlPatching(true); } XRayPatchingStatus __xray_unpatch() XRAY_NEVER_INSTRUMENT { - return ControlPatching(false); + return controlPatching(false); } diff --git a/lib/xray/xray_utils.cc b/lib/xray/xray_utils.cc index 02118c4f4..fee47df1e 100644 --- a/lib/xray/xray_utils.cc +++ b/lib/xray/xray_utils.cc @@ -34,7 +34,7 @@ namespace __xray { -void PrintToStdErr(const char *Buffer) XRAY_NEVER_INSTRUMENT { +void printToStdErr(const char *Buffer) XRAY_NEVER_INSTRUMENT { fprintf(stderr, "%s", Buffer); } @@ -132,7 +132,7 @@ long long getCPUFrequency() XRAY_NEVER_INSTRUMENT { int getLogFD() XRAY_NEVER_INSTRUMENT { // FIXME: Figure out how to make this less stderr-dependent. - SetPrintfAndReportCallback(PrintToStdErr); + SetPrintfAndReportCallback(printToStdErr); // Open a temporary file once for the log. static char TmpFilename[256] = {}; static char TmpWildcardPattern[] = "XXXXXX"; diff --git a/lib/xray/xray_utils.h b/lib/xray/xray_utils.h index d165e84ff..a78e12a4c 100644 --- a/lib/xray/xray_utils.h +++ b/lib/xray/xray_utils.h @@ -21,7 +21,7 @@ namespace __xray { // Default implementation of the reporting interface for sanitizer errors. -void PrintToStdErr(const char *Buffer); +void printToStdErr(const char *Buffer); // EINTR-safe write routine, provided a file descriptor and a character range. void retryingWriteAll(int Fd, char *Begin, char *End); |