aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseDecl.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-09-28 20:42:35 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-09-28 20:42:35 +0000
commitc5be7b0fc804d8e6f87298ec03c94d8cccd74f29 (patch)
tree58e08f5b9acae774be52b0421a073a673a291ab1 /lib/Parse/ParseDecl.cpp
parent2cf9d656f6283f2a8be0549da110d7cfbb1ea4b2 (diff)
vla expressions used in __typeof__ must be evaluated.
Fixes rdar://8476159. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114982 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseDecl.cpp')
-rw-r--r--lib/Parse/ParseDecl.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 5ed22e2753..0a48d4d550 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -320,7 +320,8 @@ AttributeList* Parser::ParseBorlandTypeAttributes(AttributeList *CurrAttr) {
/// [C++0x] static_assert-declaration
/// others... [FIXME]
///
-Parser::DeclGroupPtrTy Parser::ParseDeclaration(unsigned Context,
+Parser::DeclGroupPtrTy Parser::ParseDeclaration(StmtVector &Stmts,
+ unsigned Context,
SourceLocation &DeclEnd,
CXX0XAttributeList Attr) {
ParenBraceBracketBalancer BalancerRAIIObj(*this);
@@ -344,7 +345,8 @@ Parser::DeclGroupPtrTy Parser::ParseDeclaration(unsigned Context,
SingleDecl = ParseNamespace(Context, DeclEnd, InlineLoc);
break;
}
- return ParseSimpleDeclaration(Context, DeclEnd, Attr.AttrList, true);
+ return ParseSimpleDeclaration(Stmts, Context, DeclEnd, Attr.AttrList,
+ true);
case tok::kw_namespace:
if (Attr.HasAttr)
Diag(Attr.Range.getBegin(), diag::err_attributes_not_allowed)
@@ -361,7 +363,8 @@ Parser::DeclGroupPtrTy Parser::ParseDeclaration(unsigned Context,
SingleDecl = ParseStaticAssertDeclaration(DeclEnd);
break;
default:
- return ParseSimpleDeclaration(Context, DeclEnd, Attr.AttrList, true);
+ return ParseSimpleDeclaration(Stmts, Context, DeclEnd, Attr.AttrList,
+ true);
}
// This routine returns a DeclGroup, if the thing we parsed only contains a
@@ -376,7 +379,8 @@ Parser::DeclGroupPtrTy Parser::ParseDeclaration(unsigned Context,
///
/// If RequireSemi is false, this does not check for a ';' at the end of the
/// declaration. If it is true, it checks for and eats it.
-Parser::DeclGroupPtrTy Parser::ParseSimpleDeclaration(unsigned Context,
+Parser::DeclGroupPtrTy Parser::ParseSimpleDeclaration(StmtVector &Stmts,
+ unsigned Context,
SourceLocation &DeclEnd,
AttributeList *Attr,
bool RequireSemi) {
@@ -386,6 +390,9 @@ Parser::DeclGroupPtrTy Parser::ParseSimpleDeclaration(unsigned Context,
DS.AddAttributes(Attr);
ParseDeclarationSpecifiers(DS, ParsedTemplateInfo(), AS_none,
getDeclSpecContextFromDeclaratorContext(Context));
+ StmtResult R = Actions.ActOnVlaStmt(DS);
+ if (R.isUsable())
+ Stmts.push_back(R.release());
// C99 6.7.2.3p6: Handle "struct-or-union identifier;", "enum { X };"
// declaration-specifiers init-declarator-list[opt] ';'