aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-02-27 18:35:46 +0000
committerChris Lattner <sabre@nondot.org>2009-02-27 18:35:46 +0000
commit2a327d11a07dfbdf20910cebbae38910eda111fd (patch)
tree03ac25ecf3bbdf30da0160735336db44af7e607b
parent5e301007e31e14c8ff647288e1b8bd8dbf8a5fe4 (diff)
cleanup
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65645 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Parse/DeclSpec.h6
-rw-r--r--lib/Parse/DeclSpec.cpp1
-rw-r--r--lib/Parse/Parser.cpp2
3 files changed, 8 insertions, 1 deletions
diff --git a/include/clang/Parse/DeclSpec.h b/include/clang/Parse/DeclSpec.h
index 118d6a246e..4c1bbdf6d7 100644
--- a/include/clang/Parse/DeclSpec.h
+++ b/include/clang/Parse/DeclSpec.h
@@ -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); }
diff --git a/lib/Parse/DeclSpec.cpp b/lib/Parse/DeclSpec.cpp
index 28c8149639..a498182df7 100644
--- a/lib/Parse/DeclSpec.cpp
+++ b/lib/Parse/DeclSpec.cpp
@@ -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;
diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp
index 4398ef8ea9..30db5e6759 100644
--- a/lib/Parse/Parser.cpp
+++ b/lib/Parse/Parser.cpp
@@ -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(),