Fix a bug in getParamAttrs where an invalid value would be returned if the
authorReid Spencer <rspencer@reidspencer.com>
Sun, 31 Dec 2006 17:50:33 +0000 (17:50 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Sun, 31 Dec 2006 17:50:33 +0000 (17:50 +0000)
index passed in was out of range for the number of parameter attributes set.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32794 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Type.cpp

index 7c40cdcc1019b42897f0b30d19896dcda1a8d763..e328369d90c748ac9783403359cd0656f963c8e9 100644 (file)
@@ -1015,9 +1015,9 @@ FunctionType *FunctionType::get(const Type *ReturnType,
 FunctionType::ParameterAttributes 
 FunctionType::getParamAttrs(unsigned Idx) const {
   if (!ParamAttrs)
-    return ParameterAttributes(0);
-  if (Idx > ParamAttrs->size())
-    return ParameterAttributes(0);
+    return NoAttributeSet;
+  if (Idx >= ParamAttrs->size())
+    return NoAttributeSet;
   return (*ParamAttrs)[Idx];
 }