Bug 1508818, part 5 - Disable Clang formatting in a few places in xpcom/. r=froydnj
authorAndrew McCreight <continuation@gmail.com>
Wed, 28 Nov 2018 21:06:13 +0000
changeset 507807 d53add8e41304d0da346582da8c16fd43c9f174a
parent 507806 09c2de91a87f13c8de2da8508bae2bc2daff6b70
child 507808 c67e1875a652439706487664fda9e6c10f2285ed
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1508818
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1508818, part 5 - Disable Clang formatting in a few places in xpcom/. r=froydnj nsCRTGlue.cpp has a few data tables that get broken up badly by clang-format, so just disable the formatting. There are some more tables in this file, but the arrangement doesn't seem to matter for them. The bloat log header is just a little bit of ASCII art, so just ignore it in formatting so it is easier to read. MOZ_COLLECT_REPORT uses very wide string constants that get rewrapped in an ugly way by clang-format, so just disable the formatting for them. Depends on D13185 Differential Revision: https://phabricator.services.mozilla.com/D13186
xpcom/base/AvailableMemoryTracker.cpp
xpcom/base/nsCRTGlue.cpp
xpcom/base/nsTraceRefcnt.cpp
--- a/xpcom/base/AvailableMemoryTracker.cpp
+++ b/xpcom/base/AvailableMemoryTracker.cpp
@@ -292,16 +292,17 @@ class LowEventsReporter final : public n
   ~LowEventsReporter() {}
 
 public:
   NS_DECL_ISUPPORTS
 
   NS_IMETHOD CollectReports(nsIHandleReportCallback* aHandleReport,
                             nsISupports* aData, bool aAnonymize) override
   {
+    // clang-format off
     MOZ_COLLECT_REPORT(
       "low-memory-events/virtual", KIND_OTHER, UNITS_COUNT_CUMULATIVE,
       LowMemoryEventsVirtualDistinguishedAmount(),
 "Number of low-virtual-memory events fired since startup. We fire such an "
 "event if we notice there is less than memory.low_virtual_mem_threshold_mb of "
 "virtual address space available (if zero, this behavior is disabled). The "
 "process will probably crash if it runs out of virtual address space, so "
 "this event is dire.");
@@ -318,16 +319,17 @@ public:
     MOZ_COLLECT_REPORT(
       "low-memory-events/physical", KIND_OTHER, UNITS_COUNT_CUMULATIVE,
       LowMemoryEventsPhysicalDistinguishedAmount(),
 "Number of low-physical-memory events fired since startup. We fire such an "
 "event if we notice there is less than memory.low_physical_memory_threshold_mb "
 "of physical memory available (if zero, this behavior is disabled).  The "
 "machine will start to page if it runs out of physical memory.  This may "
 "cause it to run slowly, but it shouldn't cause it to crash.");
+    // clang-format on
 
     return NS_OK;
   }
 };
 NS_IMPL_ISUPPORTS(LowEventsReporter, nsIMemoryReporter)
 
 #endif // defined(XP_WIN)
 
--- a/xpcom/base/nsCRTGlue.cpp
+++ b/xpcom/base/nsCRTGlue.cpp
@@ -145,16 +145,18 @@ NS_xstrdup(const char* aString)
 {
   uint32_t len = strlen(aString);
   char* str = (char*)moz_xmalloc(len + 1);
   memcpy(str, aString, len);
   str[len] = '\0';
   return str;
 }
 
+// clang-format off
+
 // This table maps uppercase characters to lower case characters;
 // characters that are neither upper nor lower case are unaffected.
 const unsigned char nsLowerUpperUtils::kUpper2Lower[256] = {
     0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
    16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
    32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
    48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
    64,
@@ -195,16 +197,18 @@ const unsigned char nsLowerUpperUtils::k
   160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,
   176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,
   192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,
   208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,
   224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,
   240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255
 };
 
+// clang-format on
+
 bool
 NS_IsUpper(char aChar)
 {
   return aChar != (char)nsLowerUpperUtils::kUpper2Lower[(unsigned char)aChar];
 }
 
 bool
 NS_IsLower(char aChar)
--- a/xpcom/base/nsTraceRefcnt.cpp
+++ b/xpcom/base/nsTraceRefcnt.cpp
@@ -318,20 +318,22 @@ public:
   bool PrintDumpHeader(FILE* aOut, const char* aMsg)
   {
     fprintf(aOut, "\n== BloatView: %s, %s process %d\n", aMsg,
             XRE_ChildProcessTypeToString(XRE_GetProcessType()), getpid());
     if (gLogLeaksOnly && !mStats.HaveLeaks()) {
       return false;
     }
 
+// clang-format off
     fprintf(aOut,
             "\n" \
             "     |<----------------Class--------------->|<-----Bytes------>|<----Objects---->|\n" \
             "     |                                      | Per-Inst   Leaked|   Total      Rem|\n");
+// clang-format on
 
     this->DumpTotal(aOut);
 
     return true;
   }
 
   void Dump(int aIndex, FILE* aOut)
   {