mirror of
https://github.com/intel/llvm.git
synced 2026-02-07 16:11:27 +08:00
int X[] isn't a VLA. This improves support for stdio.h on darwin.
llvm-svn: 41423
This commit is contained in:
@@ -90,8 +90,10 @@ const llvm::Type *CodeGenTypes::ConvertType(QualType T) {
|
||||
"FIXME: We only handle trivial array types so far!");
|
||||
|
||||
llvm::APSInt Size(32);
|
||||
if (A.getSizeExpr() &&
|
||||
A.getSizeExpr()->isIntegerConstantExpr(Size, Context)) {
|
||||
if (A.getSizeExpr() == 0) {
|
||||
// int X[] -> [0 x int]
|
||||
return llvm::ArrayType::get(ConvertType(A.getElementType()), 0);
|
||||
} else if (A.getSizeExpr()->isIntegerConstantExpr(Size, Context)) {
|
||||
const llvm::Type *EltTy = ConvertType(A.getElementType());
|
||||
return llvm::ArrayType::get(EltTy, Size.getZExtValue());
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user