aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Attributes.cpp
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-07-17 18:25:56 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-07-17 18:27:39 +0200
commitf7dce88915ad1629df2d19cd41e45a5e64f2664c (patch)
tree041e83c6a6907a7f457a6438ea4c238ee3b4781b /llvm/lib/IR/Attributes.cpp
parent16458b5a6d624c07ffbf33ce958669b579bfc54e (diff)
downloadllvm-f7dce88915ad1629df2d19cd41e45a5e64f2664c.zip
llvm-f7dce88915ad1629df2d19cd41e45a5e64f2664c.tar.gz
llvm-f7dce88915ad1629df2d19cd41e45a5e64f2664c.tar.bz2
[IR] Fix MSVC warning (NFC)
As requested by Andrew Kaylor, rewrite this code in a way that does not warn on old MSVC versions. Avoid the buggy constexpr warning by just not using constexpr and removing the static_assert that depends on it.
Diffstat (limited to 'llvm/lib/IR/Attributes.cpp')
-rw-r--r--llvm/lib/IR/Attributes.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp
index d57597a..8bf4e82 100644
--- a/llvm/lib/IR/Attributes.cpp
+++ b/llvm/lib/IR/Attributes.cpp
@@ -969,7 +969,7 @@ std::string AttributeSetNode::getAsString(bool InAttrGrp) const {
/// Map from AttributeList index to the internal array index. Adding one happens
/// to work, because -1 wraps around to 0.
-static constexpr unsigned attrIdxToArrayIdx(unsigned Index) {
+static unsigned attrIdxToArrayIdx(unsigned Index) {
return Index + 1;
}
@@ -982,9 +982,7 @@ AttributeListImpl::AttributeListImpl(ArrayRef<AttributeSet> Sets)
// Initialize AvailableFunctionAttrs and AvailableSomewhereAttrs
// summary bitsets.
- static_assert(attrIdxToArrayIdx(AttributeList::FunctionIndex) == 0U,
- "function should be stored in slot 0");
- for (const auto &I : Sets[0])
+ for (const auto &I : Sets[attrIdxToArrayIdx(AttributeList::FunctionIndex)])
if (!I.isStringAttribute())
AvailableFunctionAttrs.addAttribute(I.getKindAsEnum());