]> granicus.if.org Git - clang/commitdiff
cleanup
authorChris Lattner <sabre@nondot.org>
Fri, 27 Feb 2009 18:35:46 +0000 (18:35 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 27 Feb 2009 18:35:46 +0000 (18:35 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65645 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Parse/DeclSpec.h
lib/Parse/DeclSpec.cpp
lib/Parse/Parser.cpp

index 118d6a246e8ed7a526d99b2d2ba1756e3ce84549..4c1bbdf6d76b3f3bf16bbddc72770c4ac5d7b0ff 100644 (file)
@@ -248,6 +248,12 @@ public:
   ///
   unsigned getParsedSpecifiers() const;
   
+  /// isEmpty - Return true if this declaration specifier is completely empty:
+  /// no tokens were parsed in the production of it.
+  bool isEmpty() const {
+    return getParsedSpecifiers() == DeclSpec::PQ_None;
+  }
+  
   void SetRangeStart(SourceLocation Loc) { Range.setBegin(Loc); }
   void SetRangeEnd(SourceLocation Loc) { Range.setEnd(Loc); }
   
index 28c81496390bc2af542b9f2c93b0e3a5dcf11de0..a498182df71a18a867e96fe5d05de43cfa669e89 100644 (file)
@@ -65,6 +65,7 @@ DeclaratorChunk DeclaratorChunk::getFunction(bool hasProto, bool isVariadic,
 }
 
 /// getParsedSpecifiers - Return a bitmask of which flavors of specifiers this
+/// declaration specifier includes.
 ///
 unsigned DeclSpec::getParsedSpecifiers() const {
   unsigned Res = 0;
index 4398ef8ea9c95bffcd86ced1795b690235c65a94..30db5e67590ccc55d033aaedd7cb727ff7480359 100644 (file)
@@ -549,7 +549,7 @@ Parser::DeclTy *Parser::ParseFunctionDefinition(Declarator &D) {
   // If this is C90 and the declspecs were completely missing, fudge in an
   // implicit int.  We do this here because this is the only place where
   // declaration-specifiers are completely optional in the grammar.
-  if (getLang().ImplicitInt && D.getDeclSpec().getParsedSpecifiers() == 0) {
+  if (getLang().ImplicitInt && D.getDeclSpec().isEmpty()) {
     const char *PrevSpec;
     D.getMutableDeclSpec().SetTypeSpecType(DeclSpec::TST_int,
                                            D.getIdentifierLoc(),