Change EmitVLASize to take a QualType that must be a variably modified type.
Emit the size even if the declared type is a variably modified type. This lets us handle
void f(int n) {
int (*a)[n];
printf("size: %d\n", sizeof(*a));
}
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61285 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h
index 9500068..3b95107 100644
--- a/lib/CodeGen/CodeGenFunction.h
+++ b/lib/CodeGen/CodeGenFunction.h
@@ -350,9 +350,10 @@
// instruction in LLVM instead once it works well enough.
llvm::Value *EmitVAArg(llvm::Value *VAListAddr, QualType Ty);
- // EmitVLASize - Generate code for the VLA type. Returns an
- // lLVM value that corresponds to the size in bytes of the
- llvm::Value *EmitVLASize(const VariableArrayType *);
+ // EmitVLASize - Generate code for any VLA size expressions that might occur
+ // in a variably modified type. If Ty is a VLA, will return the value that
+ // corresponds to the size in bytes of the VLA type. Will return 0 otherwise.
+ llvm::Value *EmitVLASize(QualType Ty);
// GetVLASize - Returns an LLVM value that corresponds to the size in bytes
// of a variable length array type.