From 89cb1b78f95df1f2c999db46282e41fce8dd46ca Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 23 Oct 2015 20:15:35 +0000 Subject: [PATCH] Fix the variable names to match the LLVM style. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251143 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/MC/StringTableBuilder.h | 6 ++-- lib/MC/StringTableBuilder.cpp | 54 ++++++++++++++-------------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/include/llvm/MC/StringTableBuilder.h b/include/llvm/MC/StringTableBuilder.h index 414c3adc5ea..68ad76e7fae 100644 --- a/include/llvm/MC/StringTableBuilder.h +++ b/include/llvm/MC/StringTableBuilder.h @@ -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(); diff --git a/lib/MC/StringTableBuilder.cpp b/lib/MC/StringTableBuilder.cpp index cc4fbf66385..fc6c3bc0902 100644 --- a/lib/MC/StringTableBuilder.cpp +++ b/lib/MC/StringTableBuilder.cpp @@ -18,21 +18,21 @@ using namespace llvm; static int compareBySuffix(std::pair *const *AP, std::pair *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 *> Strings; Strings.reserve(StringIndexMap.size()); for (std::pair &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 *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::max()); - uint32_t size = static_cast(StringTable.size()); + uint32_t Size = static_cast(StringTable.size()); support::endian::write( - 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)); } -- 2.34.1