Simplify code, no functionality change.

llvm-svn: 161303
This commit is contained in:
Benjamin Kramer 2012-08-04 17:00:46 +00:00
parent 70381a7b18
commit e073177e06
2 changed files with 3 additions and 8 deletions

View File

@ -2601,9 +2601,7 @@ void CGDebugInfo::EmitGlobalVariable(llvm::GlobalVariable *Var,
if (T->isIncompleteArrayType()) { if (T->isIncompleteArrayType()) {
// CodeGen turns int[] into int[1] so we'll do the same here. // CodeGen turns int[] into int[1] so we'll do the same here.
llvm::APSInt ConstVal(32); llvm::APInt ConstVal(32, 1);
ConstVal = 1;
QualType ET = CGM.getContext().getAsArrayType(T)->getElementType(); QualType ET = CGM.getContext().getAsArrayType(T)->getElementType();
T = CGM.getContext().getConstantArrayType(ET, ConstVal, T = CGM.getContext().getConstantArrayType(ET, ConstVal,
@ -2637,9 +2635,7 @@ void CGDebugInfo::EmitGlobalVariable(llvm::GlobalVariable *Var,
if (T->isIncompleteArrayType()) { if (T->isIncompleteArrayType()) {
// CodeGen turns int[] into int[1] so we'll do the same here. // CodeGen turns int[] into int[1] so we'll do the same here.
llvm::APSInt ConstVal(32); llvm::APInt ConstVal(32, 1);
ConstVal = 1;
QualType ET = CGM.getContext().getAsArrayType(T)->getElementType(); QualType ET = CGM.getContext().getAsArrayType(T)->getElementType();
T = CGM.getContext().getConstantArrayType(ET, ConstVal, T = CGM.getContext().getConstantArrayType(ET, ConstVal,

View File

@ -92,8 +92,7 @@ static void CheckStringInit(Expr *Str, QualType &DeclT, const ArrayType *AT,
if (const IncompleteArrayType *IAT = dyn_cast<IncompleteArrayType>(AT)) { if (const IncompleteArrayType *IAT = dyn_cast<IncompleteArrayType>(AT)) {
// C99 6.7.8p14. We have an array of character type with unknown size // C99 6.7.8p14. We have an array of character type with unknown size
// being initialized to a string literal. // being initialized to a string literal.
llvm::APSInt ConstVal(32); llvm::APInt ConstVal(32, StrLength);
ConstVal = StrLength;
// Return a new array type (C99 6.7.8p22). // Return a new array type (C99 6.7.8p22).
DeclT = S.Context.getConstantArrayType(IAT->getElementType(), DeclT = S.Context.getConstantArrayType(IAT->getElementType(),
ConstVal, ConstVal,