aboutsummaryrefslogtreecommitdiffstats
path: root/utils/TableGen/StringToOffsetTable.h
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2012-03-07 05:17:23 +0000
committerCraig Topper <craig.topper@gmail.com>2012-03-07 05:17:23 +0000
commitd3c9d9447ed7b5b8d3800b871ff162ae2df9fd5b (patch)
treed08e8a5fda30f7bc303ffa5fab41037e447e9228 /utils/TableGen/StringToOffsetTable.h
parentbb9dbb7d6b4f39b74b755795e31b219a5518dd77 (diff)
downloadexternal_llvm-d3c9d9447ed7b5b8d3800b871ff162ae2df9fd5b.zip
external_llvm-d3c9d9447ed7b5b8d3800b871ff162ae2df9fd5b.tar.gz
external_llvm-d3c9d9447ed7b5b8d3800b871ff162ae2df9fd5b.tar.bz2
Use uint16_t to store InstrNameIndices in MCInstrInfo. Add asserts to protect all 16-bit string table offsets. Also make sure the string to offset table string is not larger than 65536 characters since larger string literals aren't portable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152202 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/StringToOffsetTable.h')
-rw-r--r--utils/TableGen/StringToOffsetTable.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/utils/TableGen/StringToOffsetTable.h b/utils/TableGen/StringToOffsetTable.h
index 803f5bd..6d528a2b 100644
--- a/utils/TableGen/StringToOffsetTable.h
+++ b/utils/TableGen/StringToOffsetTable.h
@@ -40,6 +40,9 @@ public:
}
void EmitString(raw_ostream &O) {
+ assert(AggregateString.size() <= 65536 &&
+ "Aggregate string too large to be portable");
+
// Escape the string.
SmallString<256> Str;
raw_svector_ostream(Str).write_escaped(AggregateString);