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 | 60d35413662ebdcd1d31e34a8a7c665eb6977f1e (patch) | |
| tree | 3611941b067ec799cddd5b4d12c2cdb370b795d2 /lib/CodeGen/CodeGenFunction.h | |
| parent | f666b7780d04186521adcaedb0e15dfa4d5e6933 (diff) | |
| download | clang-60d35413662ebdcd1d31e34a8a7c665eb6977f1e.tar.gz clang-60d35413662ebdcd1d31e34a8a7c665eb6977f1e.tar.bz2 clang-60d35413662ebdcd1d31e34a8a7c665eb6977f1e.tar.xz | |
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
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.h')
| -rw-r--r-- | lib/CodeGen/CodeGenFunction.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h index 9500068814..3b951070ad 100644 --- a/lib/CodeGen/CodeGenFunction.h +++ b/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. |
