summaryrefslogtreecommitdiffstats
path: root/clang/CodeGen/CodeGenTypes.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/CodeGen/CodeGenTypes.cpp')
-rw-r--r--clang/CodeGen/CodeGenTypes.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/CodeGen/CodeGenTypes.cpp b/clang/CodeGen/CodeGenTypes.cpp
index 9fb1568a03e..8543cbd1d79 100644
--- a/clang/CodeGen/CodeGenTypes.cpp
+++ b/clang/CodeGen/CodeGenTypes.cpp
@@ -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 {
OpenPOWER on IntegriCloud