[llvm] r251143 - Fix the variable names to match the LLVM style.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 23 13:15:35 PDT 2015
Author: rafael
Date: Fri Oct 23 15:15:35 2015
New Revision: 251143
URL: http://llvm.org/viewvc/llvm-project?rev=251143&view=rev
Log:
Fix the variable names to match the LLVM style.
Modified:
llvm/trunk/include/llvm/MC/StringTableBuilder.h
llvm/trunk/lib/MC/StringTableBuilder.cpp
Modified: llvm/trunk/include/llvm/MC/StringTableBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/StringTableBuilder.h?rev=251143&r1=251142&r2=251143&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/StringTableBuilder.h (original)
+++ llvm/trunk/include/llvm/MC/StringTableBuilder.h Fri Oct 23 15:15:35 2015
@@ -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();
Modified: llvm/trunk/lib/MC/StringTableBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/StringTableBuilder.cpp?rev=251143&r1=251142&r2=251143&view=diff
==============================================================================
--- llvm/trunk/lib/MC/StringTableBuilder.cpp (original)
+++ llvm/trunk/lib/MC/StringTableBuilder.cpp Fri Oct 23 15:15:35 2015
@@ -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 k
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 k
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 k
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));
}
More information about the llvm-commits
mailing list