Skip to content

Commit

Permalink
Silence MSVC warning about unsigned integer overflow, which has defin…
Browse files Browse the repository at this point in the history
…ed behavior

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303693 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
rnk committed May 23, 2017
1 parent 78c2455 commit b9f9e91
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/IR/Attributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,9 @@ std::string AttributeSetNode::getAsString(bool InAttrGrp) const {
/// ReturnIndex: 0 -> 1
/// FirstArgIndex: 1.. -> 2..
static constexpr unsigned attrIdxToArrayIdx(unsigned Index) {
return Index + 1;
// MSVC warns about '~0U + 1' wrapping around when this is called on
// FunctionIndex, so cast to int first.
return static_cast<int>(Index) + 1;
}

AttributeListImpl::AttributeListImpl(LLVMContext &C,
Expand Down

0 comments on commit b9f9e91

Please sign in to comment.