diff options
author | Steve Naroff <snaroff@apple.com> | 2007-11-28 22:54:11 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2007-11-28 22:54:11 +0000 |
commit | 1f6443255894429fba384de0d5b6389ef578a5e9 (patch) | |
tree | 3564d5d46b5fd21400e8a83db4f17ffaca54335a /Parse/Parser.cpp | |
parent | ea75c5599072bda2dc9fc1dec2e680936c84f6f1 (diff) |
Several fixes/simplifications surrounding how we stream top-level decl AST's.
The following code...
typedef struct cssm_data {} CSSM_DATA, *CSSM_DATA_PTR;
struct Y { int A; };
struct X { int A; } D;
struct X E, F;
...now produces the following output...
> ../../Debug/bin/clang xx.c -ast-print
Read top-level tag decl: 'cssm_data'
typedef struct cssm_data CSSM_DATA;
typedef struct cssm_data *CSSM_DATA_PTR;
Read top-level tag decl: 'Y'
Read top-level tag decl: 'X'
Read top-level variable decl: 'D'
Read top-level variable decl: 'E'
Read top-level variable decl: 'F'
...which is much more accurate than the previous -ast-print output...
typedef struct cssm_data CSSM_DATA;
typedef struct cssm_data CSSM_DATA;
Read top-level variable decl: 'D'
Read top-level variable decl: 'E'
Read top-level variable decl: 'E'
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44421 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Parse/Parser.cpp')
-rw-r--r-- | Parse/Parser.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/Parse/Parser.cpp b/Parse/Parser.cpp index 8a0d8c7ecd..6e03328592 100644 --- a/Parse/Parser.cpp +++ b/Parse/Parser.cpp @@ -259,11 +259,10 @@ void Parser::Initialize() { /// ParseTopLevelDecl - Parse one top-level declaration, return whatever the /// action tells us to. This returns true if the EOF was encountered. -bool Parser::ParseTopLevelDecl(DeclTy*& Result) { - Result = 0; +bool Parser::ParseTopLevelDecl() { if (Tok.is(tok::eof)) return true; - Result = ParseExternalDeclaration(); + ParseExternalDeclaration(); return false; } @@ -281,8 +280,7 @@ void Parser::Finalize() { void Parser::ParseTranslationUnit() { Initialize(); - DeclTy *Res; - while (!ParseTopLevelDecl(Res)) + while (!ParseTopLevelDecl()) /*parse them all*/; Finalize(); |