]> granicus.if.org Git - clang/commitdiff
Support C++'s declaration-statement.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sun, 7 Sep 2008 18:58:01 +0000 (18:58 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sun, 7 Sep 2008 18:58:01 +0000 (18:58 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55888 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseStmt.cpp

index e20e056ebdb9ede6d02e418ba6964a2e6e4a8abe..5b2d3a3e0f3ecb07a3de2f2616836bf7848c844e 100644 (file)
@@ -35,6 +35,7 @@ using namespace clang;
 ///         selection-statement
 ///         iteration-statement
 ///         jump-statement
+/// [C++]   declaration-statement
 /// [OBC]   objc-throw-statement
 /// [OBC]   objc-try-catch-statement
 /// [OBC]   objc-synchronized-statement
@@ -93,7 +94,7 @@ Parser::StmtResult Parser::ParseStatementOrDeclaration(bool OnlyStatement) {
     // PASS THROUGH.
 
   default:
-    if (!OnlyStatement && isDeclarationSpecifier()) {
+    if ((getLang().CPlusPlus || !OnlyStatement) && isDeclarationSpecifier()) {
       SourceLocation DeclStart = Tok.getLocation();
       DeclTy *Res = ParseDeclaration(Declarator::BlockContext);
       // FIXME: Pass in the right location for the end of the declstmt.