diff options
author | Chris Lattner <sabre@nondot.org> | 2008-04-10 06:15:14 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-04-10 06:15:14 +0000 |
commit | 32295d344aec80a89b24f93cae3758f7bac1a207 (patch) | |
tree | fc2030a19830c609b16cb25c78140cc8471005af /clang/lib/Parse/ParseDecl.cpp | |
parent | aeb23a8a34645bb7b6d3ded09678ac65946f174c (diff) | |
download | bcm5719-llvm-32295d344aec80a89b24f93cae3758f7bac1a207.tar.gz bcm5719-llvm-32295d344aec80a89b24f93cae3758f7bac1a207.zip |
Simplify lifetime of location object.
llvm-svn: 49467
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
-rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index a7c638532d0..77287043a53 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -665,14 +665,14 @@ void Parser::ParseStructDeclaration(DeclTy *TagDecl, // Parse the common specifier-qualifiers-list piece. DeclSpec DS; - SourceLocation SpecQualLoc = Tok.getLocation(); + SourceLocation DSStart = Tok.getLocation(); ParseSpecifierQualifierList(DS); // TODO: Does specifier-qualifier list correctly check that *something* is // specified? // If there are no declarators, issue a warning. if (Tok.is(tok::semi)) { - Diag(SpecQualLoc, diag::w_no_declarators); + Diag(DSStart, diag::w_no_declarators); return; } @@ -689,11 +689,10 @@ void Parser::ParseStructDeclaration(DeclTy *TagDecl, if (Tok.is(tok::colon)) { ConsumeToken(); ExprResult Res = ParseConstantExpression(); - if (Res.isInvalid) { + if (Res.isInvalid) SkipUntil(tok::semi, true, true); - } else { + else BitfieldSize = Res.Val; - } } // If attributes exist after the declarator, parse them. @@ -701,7 +700,8 @@ void Parser::ParseStructDeclaration(DeclTy *TagDecl, DeclaratorInfo.AddAttributes(ParseAttributes()); // Install the declarator into the current TagDecl. - DeclTy *Field = Actions.ActOnField(CurScope, TagDecl, SpecQualLoc, + DeclTy *Field = Actions.ActOnField(CurScope, TagDecl, + DS.getSourceRange().getBegin(), DeclaratorInfo, BitfieldSize); FieldDecls.push_back(Field); |