[llvm-commits] [llvm] r52636 - /llvm/trunk/lib/AsmParser/llvmAsmParser.y
Dan Gohman
gohman at apple.com
Mon Jun 23 11:40:28 PDT 2008
Author: djg
Date: Mon Jun 23 13:40:28 2008
New Revision: 52636
URL: http://llvm.org/viewvc/llvm-project?rev=52636&view=rev
Log:
Fix the types for NumElements variables, and add a comment
explaining why empty array constants use ValID::createUndef().
Modified:
llvm/trunk/lib/AsmParser/llvmAsmParser.y
Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y?rev=52636&r1=52635&r2=52636&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/llvmAsmParser.y (original)
+++ llvm/trunk/lib/AsmParser/llvmAsmParser.y Mon Jun 23 13:40:28 2008
@@ -1535,7 +1535,7 @@
GEN_ERROR("Cannot make array constant with type: '" +
(*$1)->getDescription() + "'");
const Type *ETy = ATy->getElementType();
- int NumElements = ATy->getNumElements();
+ uint64_t NumElements = ATy->getNumElements();
// Verify that we have the correct size...
if (NumElements != -1 && NumElements != (int)$3->size())
@@ -1563,7 +1563,7 @@
GEN_ERROR("Cannot make array constant with type: '" +
(*$1)->getDescription() + "'");
- int NumElements = ATy->getNumElements();
+ uint64_t NumElements = ATy->getNumElements();
if (NumElements != -1 && NumElements != 0)
GEN_ERROR("Type mismatch: constant sized array initialized with 0"
" arguments, but has size of " + itostr(NumElements) +"");
@@ -1579,7 +1579,7 @@
GEN_ERROR("Cannot make array constant with type: '" +
(*$1)->getDescription() + "'");
- int NumElements = ATy->getNumElements();
+ uint64_t NumElements = ATy->getNumElements();
const Type *ETy = ATy->getElementType();
if (NumElements != -1 && NumElements != int($3->length()))
GEN_ERROR("Can't build string constant of size " +
@@ -1606,7 +1606,7 @@
GEN_ERROR("Cannot make packed constant with type: '" +
(*$1)->getDescription() + "'");
const Type *ETy = PTy->getElementType();
- int NumElements = PTy->getNumElements();
+ unsigned NumElements = PTy->getNumElements();
// Verify that we have the correct size...
if (NumElements != -1 && NumElements != (int)$3->size())
@@ -2479,7 +2479,7 @@
}
| '<' ConstVector '>' { // Nonempty unsized packed vector
const Type *ETy = (*$2)[0]->getType();
- int NumElements = $2->size();
+ unsigned NumElements = $2->size();
if (!ETy->isInteger() && !ETy->isFloatingPoint())
GEN_ERROR("Invalid vector element type: " + ETy->getDescription());
@@ -2501,7 +2501,7 @@
}
| '[' ConstVector ']' { // Nonempty unsized arr
const Type *ETy = (*$2)[0]->getType();
- int NumElements = $2->size();
+ uint64_t NumElements = $2->size();
if (!ETy->isFirstClassType())
GEN_ERROR("Invalid array element type: " + ETy->getDescription());
@@ -2522,11 +2522,13 @@
CHECK_FOR_ERROR
}
| '[' ']' {
+ // Use undef instead of an array because it's inconvenient to determine
+ // the element type at this point, there being no elements to examine.
$$ = ValID::createUndef();
CHECK_FOR_ERROR
}
| 'c' STRINGCONSTANT {
- int NumElements = $2->length();
+ uint64_t NumElements = $2->length();
const Type *ETy = Type::Int8Ty;
ArrayType *ATy = ArrayType::get(ETy, NumElements);
More information about the llvm-commits
mailing list