]> granicus.if.org Git - clang/commitdiff
Simplify lifetime of location object.
authorChris Lattner <sabre@nondot.org>
Thu, 10 Apr 2008 06:15:14 +0000 (06:15 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 10 Apr 2008 06:15:14 +0000 (06:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49467 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseDecl.cpp

index a7c638532d0df2f7627d0ee712f711415325550c..77287043a53c6b79e8490331c6ba49cfeb8b7787 100644 (file)
@@ -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);