From 2534b877b4d9aa0834b525f3bcd4e6594bfa890c Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 7 Aug 2006 05:50:47 +0000 Subject: [PATCH] add some accessor methods. llvm-svn: 38840 --- clang/include/clang/Parse/DeclSpec.h | 17 +++++++++++++++++ clang/include/clang/Parse/Parser.h | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/clang/include/clang/Parse/DeclSpec.h b/clang/include/clang/Parse/DeclSpec.h index f6ca49728a5b..cc96f01231c8 100644 --- a/clang/include/clang/Parse/DeclSpec.h +++ b/clang/include/clang/Parse/DeclSpec.h @@ -261,6 +261,13 @@ public: : DS(ds), Identifier(0), Context(C) { } + /// clear - Reset the contents of this Declarator. + void clear() { + Identifier = 0; + IdentifierLoc = SourceLocation(); + DeclTypeInfo.clear(); + } + /// mayOmitIdentifier - Return true if the identifier is either optional or /// not allowed. This is true for typenames and prototypes. bool mayOmitIdentifier() const { @@ -290,6 +297,16 @@ public: DeclTypeInfo.push_back(TI); } + /// getNumTypeObjects() - Return the number of types applied to this + /// declarator. + unsigned getNumTypeObjects() const { return DeclTypeInfo.size(); } + + /// Return the specified TypeInfo from this declarator. TypeInfo #0 is + /// closest to the identifier. + const DeclaratorTypeInfo &getTypeObject(unsigned i) const { + return DeclTypeInfo[i]; + } + /// isInnermostFunctionType - Once this declarator is fully parsed and formed, /// this method returns true if the identifier is a function declarator. bool isInnermostFunctionType() const { diff --git a/clang/include/clang/Parse/Parser.h b/clang/include/clang/Parse/Parser.h index fb22a2ee17ba..2956f39101e4 100644 --- a/clang/include/clang/Parse/Parser.h +++ b/clang/include/clang/Parse/Parser.h @@ -154,7 +154,7 @@ private: // C99 6.9: External Definitions. void ParseExternalDeclaration(); void ParseDeclarationOrFunctionDefinition(); - + void ParseFunctionDefinition(Declarator &D); //===--------------------------------------------------------------------===// // C99 6.7: Declarations.