summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Attributes.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2017-05-23 21:35:32 +0000
committerReid Kleckner <rnk@google.com>2017-05-23 21:35:32 +0000
commit26450bf5794da92518261e802e10bd5195fe5754 (patch)
tree5c3ef9b7195ddbc7bd2b6cf9fa41b082e8453543 /llvm/lib/IR/Attributes.cpp
parent41c96dc7ffcc995b959653ff4612fb25fc4d857a (diff)
downloadbcm5719-llvm-26450bf5794da92518261e802e10bd5195fe5754.tar.gz
bcm5719-llvm-26450bf5794da92518261e802e10bd5195fe5754.zip
Silence MSVC warning about unsigned integer overflow, which has defined behavior
llvm-svn: 303693
Diffstat (limited to 'llvm/lib/IR/Attributes.cpp')
-rw-r--r--llvm/lib/IR/Attributes.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp
index bcdc97e2ed8..19b7c302723 100644
--- a/llvm/lib/IR/Attributes.cpp
+++ b/llvm/lib/IR/Attributes.cpp
@@ -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,
OpenPOWER on IntegriCloud