[cfe-commits] r49467 - /cfe/trunk/lib/Parse/ParseDecl.cpp

Chris Lattner sabre at nondot.org
Wed Apr 9 23:15:14 PDT 2008


Author: lattner
Date: Thu Apr 10 01:15:14 2008
New Revision: 49467

URL: http://llvm.org/viewvc/llvm-project?rev=49467&view=rev
Log:
Simplify lifetime of location object.

Modified:
    cfe/trunk/lib/Parse/ParseDecl.cpp

Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=49467&r1=49466&r2=49467&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Thu Apr 10 01:15:14 2008
@@ -665,14 +665,14 @@
   
   // 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 @@
     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 @@
       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);
     





More information about the cfe-commits mailing list