Fix the variable names to match the LLVM style.
authorRafael Espindola <rafael.espindola@gmail.com>
Fri, 23 Oct 2015 20:15:35 +0000 (20:15 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Fri, 23 Oct 2015 20:15:35 +0000 (20:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251143 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/MC/StringTableBuilder.h
lib/MC/StringTableBuilder.cpp

index 414c3adc5eac847f4336d0905980c76f078ad51a..68ad76e7fae9e48f156df45f0836c9d9aabfe88e 100644 (file)
@@ -24,7 +24,7 @@ class StringTableBuilder {
 public:
   /// \brief Add a string to the builder. Returns a StringRef to the internal
   /// copy of s. Can only be used before the table is finalized.
-  void add(StringRef s);
+  void add(StringRef S);
 
   enum Kind {
     ELF,
@@ -34,7 +34,7 @@ public:
 
   /// \brief Analyze the strings and build the final table. No more strings can
   /// be added after this point.
-  void finalize(Kind kind);
+  void finalize(Kind K);
 
   /// \brief Retrieve the string table data. Can only be used after the table
   /// is finalized.
@@ -45,7 +45,7 @@ public:
 
   /// \brief Get the offest of a string in the string table. Can only be used
   /// after the table is finalized.
-  size_t getOffset(StringRef s) const;
+  size_t getOffset(StringRef S) const;
 
   void clear();
 
index cc4fbf66385598a220302a7cb6f3d6e10a2a90ce..fc6c3bc09021e0b58b9c76383a57bda75a96d9f7 100644 (file)
@@ -18,21 +18,21 @@ using namespace llvm;
 
 static int compareBySuffix(std::pair<StringRef, size_t> *const *AP,
                            std::pair<StringRef, size_t> *const *BP) {
-  StringRef a = (*AP)->first;
-  StringRef b = (*BP)->first;
-  size_t sizeA = a.size();
-  size_t sizeB = b.size();
-  size_t len = std::min(sizeA, sizeB);
-  for (size_t i = 0; i < len; ++i) {
-    char ca = a[sizeA - i - 1];
-    char cb = b[sizeB - i - 1];
-    if (ca != cb)
-      return cb - ca;
+  StringRef A = (*AP)->first;
+  StringRef B = (*BP)->first;
+  size_t SizeA = A.size();
+  size_t SizeB = B.size();
+  size_t Len = std::min(SizeA, SizeB);
+  for (size_t I = 0; I < Len; ++I) {
+    char CA = A[SizeA - I - 1];
+    char CB = B[SizeB - I - 1];
+    if (CA != CB)
+      return CB - CA;
   }
-  return sizeB - sizeA;
+  return SizeB - SizeA;
 }
 
-void StringTableBuilder::finalize(Kind kind) {
+void StringTableBuilder::finalize(Kind K) {
   std::vector<std::pair<StringRef, size_t> *> Strings;
   Strings.reserve(StringIndexMap.size());
   for (std::pair<StringRef, size_t> &P : StringIndexMap)
@@ -40,7 +40,7 @@ void StringTableBuilder::finalize(Kind kind) {
 
   array_pod_sort(Strings.begin(), Strings.end(), compareBySuffix);
 
-  switch (kind) {
+  switch (K) {
   case ELF:
   case MachO:
     // Start the table with a NUL byte.
@@ -54,22 +54,22 @@ void StringTableBuilder::finalize(Kind kind) {
 
   StringRef Previous;
   for (std::pair<StringRef, size_t> *P : Strings) {
-    StringRef s = P->first;
-    if (kind == WinCOFF)
-      assert(s.size() > COFF::NameSize && "Short string in COFF string table!");
+    StringRef S = P->first;
+    if (K == WinCOFF)
+      assert(S.size() > COFF::NameSize && "Short string in COFF string table!");
 
-    if (Previous.endswith(s)) {
-      P->second = StringTable.size() - 1 - s.size();
+    if (Previous.endswith(S)) {
+      P->second = StringTable.size() - 1 - S.size();
       continue;
     }
 
     P->second = StringTable.size();
-    StringTable += s;
+    StringTable += S;
     StringTable += '\x00';
-    Previous = s;
+    Previous = S;
   }
 
-  switch (kind) {
+  switch (K) {
   case ELF:
     break;
   case MachO:
@@ -80,9 +80,9 @@ void StringTableBuilder::finalize(Kind kind) {
   case WinCOFF:
     // Write the table size in the first word.
     assert(StringTable.size() <= std::numeric_limits<uint32_t>::max());
-    uint32_t size = static_cast<uint32_t>(StringTable.size());
+    uint32_t Size = static_cast<uint32_t>(StringTable.size());
     support::endian::write<uint32_t, support::little, support::unaligned>(
-        StringTable.data(), size);
+        StringTable.data(), Size);
     break;
   }
 }
@@ -92,14 +92,14 @@ void StringTableBuilder::clear() {
   StringIndexMap.clear();
 }
 
-size_t StringTableBuilder::getOffset(StringRef s) const {
+size_t StringTableBuilder::getOffset(StringRef S) const {
   assert(isFinalized());
-  auto I = StringIndexMap.find(s);
+  auto I = StringIndexMap.find(S);
   assert(I != StringIndexMap.end() && "String is not in table!");
   return I->second;
 }
 
-void StringTableBuilder::add(StringRef s) {
+void StringTableBuilder::add(StringRef S) {
   assert(!isFinalized());
-  StringIndexMap.insert(std::make_pair(s, 0));
+  StringIndexMap.insert(std::make_pair(S, 0));
 }