[compiler-rt] r294373 - [XRay][compiler-rt][NFC] Turn ProudCase functions to humbleCase functions

Dean Michael Berris via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 7 15:35:34 PST 2017


Author: dberris
Date: Tue Feb  7 17:35:34 2017
New Revision: 294373

URL: http://llvm.org/viewvc/llvm-project?rev=294373&view=rev
Log:
[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

Modified:
    compiler-rt/trunk/lib/xray/tests/unit/fdr_logging_test.cc
    compiler-rt/trunk/lib/xray/xray_arm.cc
    compiler-rt/trunk/lib/xray/xray_fdr_logging.cc
    compiler-rt/trunk/lib/xray/xray_fdr_logging.h
    compiler-rt/trunk/lib/xray/xray_flags.cc
    compiler-rt/trunk/lib/xray/xray_flags.h
    compiler-rt/trunk/lib/xray/xray_init.cc
    compiler-rt/trunk/lib/xray/xray_interface.cc
    compiler-rt/trunk/lib/xray/xray_utils.cc
    compiler-rt/trunk/lib/xray/xray_utils.h

Modified: compiler-rt/trunk/lib/xray/tests/unit/fdr_logging_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/tests/unit/fdr_logging_test.cc?rev=294373&r1=294372&r2=294373&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/tests/unit/fdr_logging_test.cc (original)
+++ compiler-rt/trunk/lib/xray/tests/unit/fdr_logging_test.cc Tue Feb  7 17:35:34 2017
@@ -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.

Modified: compiler-rt/trunk/lib/xray/xray_arm.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_arm.cc?rev=294373&r1=294372&r2=294373&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/xray_arm.cc (original)
+++ compiler-rt/trunk/lib/xray/xray_arm.cc Tue Feb  7 17:35:34 2017
@@ -74,7 +74,7 @@ write32bitLoadReg(uint8_t regNo, uint32_
 //   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
   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);

Modified: compiler-rt/trunk/lib/xray/xray_fdr_logging.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_fdr_logging.cc?rev=294373&r1=294372&r2=294373&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/xray_fdr_logging.cc (original)
+++ compiler-rt/trunk/lib/xray/xray_fdr_logging.cc Tue Feb  7 17:35:34 2017
@@ -55,7 +55,7 @@ std::atomic<XRayLogFlushStatus> LogFlush
 
 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::s
   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::s
   }
 
   // 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::s
 }
 
 // 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() XR
   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()
   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);
   }

Modified: compiler-rt/trunk/lib/xray/xray_fdr_logging.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_fdr_logging.h?rev=294373&r1=294372&r2=294373&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/xray_fdr_logging.h (original)
+++ compiler-rt/trunk/lib/xray/xray_fdr_logging.h Tue Feb  7 17:35:34 2017
@@ -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
 

Modified: compiler-rt/trunk/lib/xray/xray_flags.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_flags.cc?rev=294373&r1=294372&r2=294373&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/xray_flags.cc (original)
+++ compiler-rt/trunk/lib/xray/xray_flags.cc Tue Feb  7 17:35:34 2017
@@ -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.

Modified: compiler-rt/trunk/lib/xray/xray_flags.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_flags.h?rev=294373&r1=294372&r2=294373&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/xray_flags.h (original)
+++ compiler-rt/trunk/lib/xray/xray_flags.h Tue Feb  7 17:35:34 2017
@@ -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
 

Modified: compiler-rt/trunk/lib/xray/xray_init.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_init.cc?rev=294373&r1=294372&r2=294373&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/xray_init.cc (original)
+++ compiler-rt/trunk/lib/xray/xray_init.cc Tue Feb  7 17:35:34 2017
@@ -46,7 +46,7 @@ std::atomic<__xray::XRaySledMap> XRayIns
 // __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;

Modified: compiler-rt/trunk/lib/xray/xray_interface.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_interface.cc?rev=294373&r1=294372&r2=294373&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/xray_interface.cc (original)
+++ compiler-rt/trunk/lib/xray/xray_interface.cc Tue Feb  7 17:35:34 2017
@@ -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
   }
 
   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
 }
 
 XRayPatchingStatus __xray_patch() XRAY_NEVER_INSTRUMENT {
-  return ControlPatching(true);
+  return controlPatching(true);
 }
 
 XRayPatchingStatus __xray_unpatch() XRAY_NEVER_INSTRUMENT {
-  return ControlPatching(false);
+  return controlPatching(false);
 }

Modified: compiler-rt/trunk/lib/xray/xray_utils.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_utils.cc?rev=294373&r1=294372&r2=294373&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/xray_utils.cc (original)
+++ compiler-rt/trunk/lib/xray/xray_utils.cc Tue Feb  7 17:35:34 2017
@@ -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_I
 
 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";

Modified: compiler-rt/trunk/lib/xray/xray_utils.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_utils.h?rev=294373&r1=294372&r2=294373&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/xray_utils.h (original)
+++ compiler-rt/trunk/lib/xray/xray_utils.h Tue Feb  7 17:35:34 2017
@@ -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);




More information about the llvm-commits mailing list