summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/FoldingSet.cpp
diff options
context:
space:
mode:
authorGabor Horvath <xazax.hun@gmail.com>2015-03-16 09:53:42 +0000
committerGabor Horvath <xazax.hun@gmail.com>2015-03-16 09:53:42 +0000
commitfee043439c8f2dc63c408228ea52fdefb6514d80 (patch)
tree69ff502bbfae13e758a78b6cbee43a183459e070 /llvm/lib/Support/FoldingSet.cpp
parentbd250daee053252042ed5a33c8b13e3b24a61f52 (diff)
downloadbcm5719-llvm-fee043439c8f2dc63c408228ea52fdefb6514d80.tar.gz
bcm5719-llvm-fee043439c8f2dc63c408228ea52fdefb6514d80.zip
[llvm] Replacing asserts with static_asserts where appropriate
Summary: This patch consists of the suggestions of clang-tidy/misc-static-assert check. Reviewers: alexfh Reviewed By: alexfh Subscribers: xazax.hun, llvm-commits Differential Revision: http://reviews.llvm.org/D8343 llvm-svn: 232366
Diffstat (limited to 'llvm/lib/Support/FoldingSet.cpp')
-rw-r--r--llvm/lib/Support/FoldingSet.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Support/FoldingSet.cpp b/llvm/lib/Support/FoldingSet.cpp
index 46351140875..0bee31510f7 100644
--- a/llvm/lib/Support/FoldingSet.cpp
+++ b/llvm/lib/Support/FoldingSet.cpp
@@ -101,6 +101,8 @@ void FoldingSetNodeID::AddString(StringRef String) {
// Otherwise do it the hard way.
// To be compatible with above bulk transfer, we need to take endianness
// into account.
+ static_assert(sys::IsBigEndianHost || sys::IsLittleEndianHost,
+ "Unexpected host endianness");
if (sys::IsBigEndianHost) {
for (Pos += 4; Pos <= Size; Pos += 4) {
unsigned V = ((unsigned char)String[Pos - 4] << 24) |
@@ -109,8 +111,7 @@ void FoldingSetNodeID::AddString(StringRef String) {
(unsigned char)String[Pos - 1];
Bits.push_back(V);
}
- } else {
- assert(sys::IsLittleEndianHost && "Unexpected host endianness");
+ } else { // Little-endian host
for (Pos += 4; Pos <= Size; Pos += 4) {
unsigned V = ((unsigned char)String[Pos - 1] << 24) |
((unsigned char)String[Pos - 2] << 16) |
OpenPOWER on IntegriCloud