[cfe-commits] r38910 - in /cfe/cfe/trunk/Parse: Actions.cpp ParseDecl.cpp
sabre at cs.uiuc.edu
sabre at cs.uiuc.edu
Wed Jul 11 09:25:41 PDT 2007
Author: sabre
Date: Wed Jul 11 11:25:41 2007
New Revision: 38910
URL: http://llvm.org/viewvc/llvm-project?rev=38910&view=rev
Log:
Inform actions about parsed declarators.
Removed:
cfe/cfe/trunk/Parse/Actions.cpp
Modified:
cfe/cfe/trunk/Parse/ParseDecl.cpp
Removed: cfe/cfe/trunk/Parse/Actions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Parse/Actions.cpp?rev=38909&view=auto
==============================================================================
--- cfe/cfe/trunk/Parse/Actions.cpp (original)
+++ cfe/cfe/trunk/Parse/Actions.cpp (removed)
@@ -1,18 +0,0 @@
-//===--- Actions.cpp - C Language Family Default Parser Actions -----------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file was developed by Chris Lattner and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements the default ParserActions method (which are noops).
-//
-//===----------------------------------------------------------------------===//
-
-#include "clang/Parse/ParserActions.h"
-using namespace llvm;
-using namespace clang;
-
-
Modified: cfe/cfe/trunk/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Parse/ParseDecl.cpp?rev=38910&r1=38909&r2=38910&view=diff
==============================================================================
--- cfe/cfe/trunk/Parse/ParseDecl.cpp (original)
+++ cfe/cfe/trunk/Parse/ParseDecl.cpp Wed Jul 11 11:25:41 2007
@@ -58,18 +58,41 @@
ParseInitDeclaratorListAfterFirstDeclarator(DeclaratorInfo);
}
+/// ParseInitDeclaratorListAfterFirstDeclarator - Parse 'declaration' after
+/// parsing 'declaration-specifiers declarator'. This method is split out this
+/// way to handle the ambiguity between top-level function-definitions and
+/// declarations.
+///
+/// declaration: [C99 6.7]
+/// declaration-specifiers init-declarator-list[opt] ';' [TODO]
+/// [!C99] init-declarator-list ';' [TODO]
+/// [OMP] threadprivate-directive [TODO]
+///
+/// init-declarator-list: [C99 6.7]
+/// init-declarator
+/// init-declarator-list ',' init-declarator
+/// init-declarator: [C99 6.7]
+/// declarator
+/// declarator '=' initializer
+///
void Parser::ParseInitDeclaratorListAfterFirstDeclarator(Declarator &D) {
// At this point, we know that it is not a function definition. Parse the
// rest of the init-declarator-list.
while (1) {
// must be: decl-spec[opt] declarator init-declarator-list
// Parse declarator '=' initializer.
+ ExprResult Init;
if (Tok.getKind() == tok::equal) {
ConsumeToken();
- ParseInitializer();
+ Init = ParseInitializer();
+ if (!Init.isInvalid) {
+ SkipUntil(tok::semi);
+ return;
+ }
}
- // TODO: install declarator.
+ // Inform the current actions module that we just parsed a declarator.
+ Actions.ParseDeclarator(Tok.getLocation(), CurScope, D, Init.Val);
// If we don't have a comma, it is either the end of the list (a ';') or an
// error, bail out.
More information about the cfe-commits
mailing list