From 8a01b79274be3a2128be030f1ef3180d26e7317c Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Sat, 20 Dec 2008 20:46:34 +0000 Subject: 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)); } llvm-svn: 61285 --- clang/lib/CodeGen/CodeGenFunction.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenFunction.h') diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index 95000688147..3b951070adb 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -350,9 +350,10 @@ public: // 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. -- cgit v1.2.3