diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2010-09-28 20:42:35 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-09-28 20:42:35 +0000 |
commit | 1db5c941ad02d7aabd729d2a158a0f9550b77718 (patch) | |
tree | d12b2cd88fed61205fd095b99b9f9e4f59386cdd /clang/lib/Sema/SemaDecl.cpp | |
parent | 1b35f4cc66debe68571216ca35672b021ea9baa7 (diff) | |
download | bcm5719-llvm-1db5c941ad02d7aabd729d2a158a0f9550b77718.tar.gz bcm5719-llvm-1db5c941ad02d7aabd729d2a158a0f9550b77718.zip |
vla expressions used in __typeof__ must be evaluated.
Fixes rdar://8476159.
llvm-svn: 114982
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index e6e4420f23b..544d9842c12 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -1691,6 +1691,25 @@ Decl *Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, return TagD; } +/// ActOnVlaStmt - This rouine if finds a vla expression in a decl spec. +/// builds a statement for it and returns it so it is evaluated. +StmtResult Sema::ActOnVlaStmt(const DeclSpec &DS) { + StmtResult R; + if (DS.getTypeSpecType() == DeclSpec::TST_typeofExpr) { + Expr *Exp = DS.getRepAsExpr(); + QualType Ty = Exp->getType(); + if (Ty->isPointerType()) { + do + Ty = Ty->getAs<PointerType>()->getPointeeType(); + while (Ty->isPointerType()); + } + if (Ty->isVariableArrayType()) { + R = ActOnExprStmt(MakeFullExpr(Exp)); + } + } + return R; +} + /// We are trying to inject an anonymous member into the given scope; /// check if there's an existing declaration that can't be overloaded. /// |