Silence MSVC warning about unsigned integer overflow, which has defined behavior

llvm-svn: 303693
This commit is contained in:
Reid Kleckner 2017-05-23 21:35:32 +00:00
parent 41c96dc7ff
commit 26450bf579
1 changed files with 3 additions and 1 deletions

View File

@ -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,