diff options
author | Anders Carlsson <andersca@mac.com> | 2008-12-20 20:46:34 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2008-12-20 20:46:34 +0000 |
commit | 8a01b79274be3a2128be030f1ef3180d26e7317c (patch) | |
tree | 7a0c115c5628f3e4d95dac918ab5203e46e6a274 /clang/lib/CodeGen/CodeGenFunction.h | |
parent | e388a5bf44aba581bc17a40235b630c6383ae931 (diff) | |
download | bcm5719-llvm-8a01b79274be3a2128be030f1ef3180d26e7317c.tar.gz bcm5719-llvm-8a01b79274be3a2128be030f1ef3180d26e7317c.zip |
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
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.h')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.h | 7 |
1 files changed, 4 insertions, 3 deletions
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. |