Skip to content

Commit 3aaac0f

Browse files
committed
[Mangler] Emit auto-generated constants as 'const'.
1 parent 5b32777 commit 3aaac0f

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

lib/ABI/CBCTables.h

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

lib/ABI/HuffTables.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ using APInt = llvm::APInt;
77
// Processing text files: CBC_Compressed.txt.cbc
88
namespace Huffman {
99
// The charset that the fragment indices can use:
10-
unsigned CharsetLength = 64;
11-
unsigned LongestEncodingLength = 8;
10+
const unsigned CharsetLength = 64;
11+
const unsigned LongestEncodingLength = 8;
1212
const char *Charset = "0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$";
1313
char variable_decode(APInt &num) {
1414
uint64_t tailbits = *num.getRawData();

utils/name-compression/CBCGen.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,13 @@ def generate(self, depth):
130130

131131
print "namespace CBC {"
132132
print "// The charset that the fragment indices can use:"
133-
print "unsigned CharsetLength = %d;" % len(charset)
133+
print "const unsigned CharsetLength = %d;" % len(charset)
134134
print "const char *Charset = \"%s\";" % charset
135135
print "const int IndexOfChar[] = {", ",".join(index_of_char),"};"
136136
print "const char EscapeChar0 = '%s';" % escape_char0
137137
print "const char EscapeChar1 = '%s';" % escape_char1
138138
print "// The Fragments:"
139-
print "unsigned NumFragments = ", len(string_key_list), ";"
139+
print "const unsigned NumFragments = ", len(string_key_list), ";"
140140
print "const char* CodeBook[] = {", ",".join(string_key_list),"};"
141141
print "const unsigned CodeBookLen[] = {", ",".join(string_length_table),"};"
142142
print TrieHead.generateHeader()

utils/name-compression/HuffGen.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ def generate_encoder(self, stack):
116116
print "// Processing text files:", " ".join([os.path.basename(f) for f in filenames])
117117
print "namespace Huffman {"
118118
print "// The charset that the fragment indices can use:"
119-
print "unsigned CharsetLength = %d;" % len(charset)
120-
print "unsigned LongestEncodingLength = %d;" % (nodes[0].getMaxEncodingLength())
119+
print "const unsigned CharsetLength = %d;" % len(charset)
120+
print "const unsigned LongestEncodingLength = %d;" % (nodes[0].getMaxEncodingLength())
121121
print "const char *Charset = \"%s\";" % charset
122122
print "char variable_decode(APInt &num) {\n uint64_t tailbits = *num.getRawData();\n", nodes[0].generate_decoder(0), "\n assert(false); return 0;\n}"
123123
print "void variable_encode(uint64_t &bits, uint64_t &num_bits, char ch) {\n", nodes[0].generate_encoder([]),"assert(false);\n}"

0 commit comments

Comments
 (0)