summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGDecl.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2008-12-20 21:51:53 +0000
committerAnders Carlsson <andersca@mac.com>2008-12-20 21:51:53 +0000
commit5d985f5f16eddd2af0ac091c4832caa5ba8b1a36 (patch)
treefcab2edd3b134df22952a25e308bc3bd71f41bb7 /clang/lib/CodeGen/CGDecl.cpp
parentfbef9c208f9bd52254db20178fc4555c52a9a583 (diff)
downloadbcm5719-llvm-5d985f5f16eddd2af0ac091c4832caa5ba8b1a36.tar.gz
bcm5719-llvm-5d985f5f16eddd2af0ac091c4832caa5ba8b1a36.zip
Handle typedefs to VLAs (Emit the size expr when we encounter the typedef
llvm-svn: 61290
Diffstat (limited to 'clang/lib/CodeGen/CGDecl.cpp')
-rw-r--r--clang/lib/CodeGen/CGDecl.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index e8084dcf179..86bc3475761 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/lib/CodeGen/CGDecl.cpp
@@ -31,7 +31,6 @@ void CodeGenFunction::EmitDecl(const Decl &D) {
default: assert(0 && "Unknown decl kind!");
case Decl::ParmVar:
assert(0 && "Parmdecls should not be in declstmts!");
- case Decl::Typedef: // typedef int X;
case Decl::Function: // void X();
case Decl::Record: // struct/union/class X;
case Decl::Enum: // enum X;
@@ -46,6 +45,14 @@ void CodeGenFunction::EmitDecl(const Decl &D) {
"Should not see file-scope variables inside a function!");
return EmitBlockVarDecl(VD);
}
+
+ case Decl::Typedef: { // typedef int X;
+ const TypedefDecl &TD = cast<TypedefDecl>(D);
+ QualType Ty = TD.getUnderlyingType();
+
+ if (Ty->isVariablyModifiedType())
+ EmitVLASize(Ty);
+ }
}
}
OpenPOWER on IntegriCloud