namespace {
class ParserPrintActions : public MinimalAction {
- /// ParseDeclarator - This callback is invoked when a declarator is parsed
+ /// ActOnDeclarator - This callback is invoked when a declarator is parsed
/// and 'Init' specifies the initializer if any. This is for things like:
/// "int X = 4" or "typedef int foo".
- virtual DeclTy *ParseDeclarator(Scope *S, Declarator &D,
+ virtual DeclTy *ActOnDeclarator(Scope *S, Declarator &D,
DeclTy *LastInGroup) {
- std::cout << "ParseDeclarator ";
+ std::cout << "ActOnDeclarator ";
if (IdentifierInfo *II = D.getIdentifier()) {
std::cout << "'" << II->getName() << "'";
} else {
std::cout << "\n";
// Pass up to EmptyActions so that the symbol table is maintained right.
- return MinimalAction::ParseDeclarator(S, D, LastInGroup);
+ return MinimalAction::ActOnDeclarator(S, D, LastInGroup);
}
/// PopScope - This callback is called immediately before the specified scope
return 0;
}
-/// ParseDeclarator - If this is a typedef declarator, we modify the
+/// ActOnDeclarator - If this is a typedef declarator, we modify the
/// IdentifierInfo::FETokenInfo field to keep track of this fact, until S is
/// popped.
Action::DeclTy *
-MinimalAction::ParseDeclarator(Scope *S, Declarator &D, DeclTy *LastInGroup) {
+MinimalAction::ActOnDeclarator(Scope *S, Declarator &D, DeclTy *LastInGroup) {
IdentifierInfo *II = D.getIdentifier();
// If there is no identifier associated with this declarator, bail out.
Declarator DeclaratorInfo(DS, Declarator::TypeNameContext);
ParseDeclarator(DeclaratorInfo);
- return Actions.ParseTypeName(CurScope, DeclaratorInfo).Val;
+ return Actions.ActOnTypeName(CurScope, DeclaratorInfo).Val;
}
/// ParseAttributes - Parse a non-empty attributes list.
// Inform the current actions module that we just parsed this declarator.
// FIXME: pass asm & attributes.
- LastDeclInGroup = Actions.ParseDeclarator(CurScope, D, LastDeclInGroup);
+ LastDeclInGroup = Actions.ActOnDeclarator(CurScope, D, LastDeclInGroup);
// Parse declarator '=' initializer.
ExprResult Init;
TK = Action::TK_Declaration;
else
TK = Action::TK_Reference;
- Decl = Actions.ParseTag(CurScope, TagType, TK, StartLoc, Name, NameLoc, Attr);
+ Decl = Actions.ActOnTag(CurScope, TagType, TK, StartLoc, Name, NameLoc, Attr);
return false;
}
DeclaratorInfo.AddAttributes(ParseAttributes());
// Install the declarator into the current TagDecl.
- DeclTy *Field = Actions.ParseField(CurScope, TagDecl, SpecQualLoc,
+ DeclTy *Field = Actions.ActOnField(CurScope, TagDecl, SpecQualLoc,
DeclaratorInfo, BitfieldSize);
FieldDecls.push_back(Field);
MatchRHSPunctuation(tok::r_brace, LBraceLoc);
- Actions.ProcessFieldDecls(RecordLoc,TagDecl,&FieldDecls[0],FieldDecls.size());
+ Actions.ActOnFields(RecordLoc,TagDecl,&FieldDecls[0],FieldDecls.size());
AttributeList *AttrList = 0;
// If attributes exist after struct contents, parse them.
}
// Install the enumerator constant into EnumDecl.
- DeclTy *EnumConstDecl = Actions.ParseEnumConstant(CurScope, EnumDecl,
+ DeclTy *EnumConstDecl = Actions.ActOnEnumConstant(CurScope, EnumDecl,
LastEnumConstDecl,
IdentLoc, Ident,
EqualLoc, AssignedVal);
// Eat the }.
MatchRHSPunctuation(tok::r_brace, LBraceLoc);
- Actions.ParseEnumBody(StartLoc, EnumDecl, &EnumConstantDecls[0],
+ Actions.ActOnEnumBody(StartLoc, EnumDecl, &EnumConstantDecls[0],
EnumConstantDecls.size());
DeclTy *AttrList = 0;
// Inform the actions module about the parameter declarator, so it gets
// added to the current scope.
Action::TypeResult ParamTy =
- Actions.ParseParamDeclaratorType(CurScope, ParmDecl);
+ Actions.ActOnParamDeclaratorType(CurScope, ParmDecl);
// Remember this parsed parameter in ParamInfo.
IdentifierInfo *ParmII = ParmDecl.getIdentifier();
// primary-expression: identifier
// Let the actions module handle the identifier.
- ExprResult Res = Actions.ParseIdentifierExpr(CurScope, IdTok.getLocation(),
+ ExprResult Res = Actions.ActOnIdentifierExpr(CurScope, IdTok.getLocation(),
*IdTok.getIdentifierInfo(),
Tok.getKind() == tok::l_paren);
// primary-expression: identifier
// Let the actions module handle the identifier.
- ExprResult Res = Actions.ParseIdentifierExpr(CurScope, IdTok.getLocation(),
+ ExprResult Res = Actions.ActOnIdentifierExpr(CurScope, IdTok.getLocation(),
*IdTok.getIdentifierInfo(),
Tok.getKind() == tok::l_paren);
// not.
IdentifierInfo &II = *Tok.getIdentifierInfo();
SourceLocation L = ConsumeToken();
- Res = Actions.ParseIdentifierExpr(CurScope, L, II,
+ Res = Actions.ActOnIdentifierExpr(CurScope, L, II,
Tok.getKind() == tok::l_paren);
// These can be followed by postfix-expr pieces.
return ParsePostfixExpressionSuffix(Res);
}
}
if (AllIvarDecls.size()) { // Check for {} - no ivars in braces
- Actions.ProcessFieldDecls(LBraceLoc, interfaceDecl,
- &AllIvarDecls[0], AllIvarDecls.size(),
- &AllVisibilities[0]);
+ Actions.ActOnFields(LBraceLoc, interfaceDecl,
+ &AllIvarDecls[0], AllIvarDecls.size(),
+ &AllVisibilities[0]);
}
MatchRHSPunctuation(tok::r_brace, LBraceLoc);
return;
Declarator D(DS, Declarator::FileContext);
D.SetIdentifier(PP.getIdentifierInfo("__builtin_va_list"),SourceLocation());
- Actions.ParseDeclarator(CurScope, D, 0);
+ Actions.ActOnDeclarator(CurScope, D, 0);
}
if (Tok.getKind() == tok::eof &&
// Ask the actions module to compute the type for this declarator.
Action::TypeResult TR =
- Actions.ParseParamDeclaratorType(CurScope, ParmDeclarator);
+ Actions.ActOnParamDeclaratorType(CurScope, ParmDeclarator);
if (!TR.isInvalid &&
// A missing identifier has already been diagnosed.
//
QualType GetTypeForDeclarator(Declarator &D, Scope *S);
- virtual TypeResult ParseTypeName(Scope *S, Declarator &D);
+ virtual TypeResult ActOnTypeName(Scope *S, Declarator &D);
- virtual TypeResult ParseParamDeclaratorType(Scope *S, Declarator &D);
+ virtual TypeResult ActOnParamDeclaratorType(Scope *S, Declarator &D);
private:
//===--------------------------------------------------------------------===//
// Symbol table / Decl tracking callbacks: SemaDecl.cpp.
//
virtual DeclTy *isTypeName(const IdentifierInfo &II, Scope *S) const;
- virtual DeclTy *ParseDeclarator(Scope *S, Declarator &D, DeclTy *LastInGroup);
+ virtual DeclTy *ActOnDeclarator(Scope *S, Declarator &D, DeclTy *LastInGroup);
void AddInitializerToDecl(DeclTy *dcl, ExprTy *init);
virtual DeclTy *FinalizeDeclaratorGroup(Scope *S, DeclTy *Group);
/// no declarator (e.g. "struct foo;") is parsed.
virtual DeclTy *ParsedFreeStandingDeclSpec(Scope *S, DeclSpec &DS);
- virtual DeclTy *ParseTag(Scope *S, unsigned TagType, TagKind TK,
+ virtual DeclTy *ActOnTag(Scope *S, unsigned TagType, TagKind TK,
SourceLocation KWLoc, IdentifierInfo *Name,
SourceLocation NameLoc, AttributeList *Attr);
- virtual DeclTy *ParseField(Scope *S, DeclTy *TagDecl,SourceLocation DeclStart,
+ virtual DeclTy *ActOnField(Scope *S, DeclTy *TagDecl,SourceLocation DeclStart,
Declarator &D, ExprTy *BitfieldWidth);
// This is used for both record definitions and ObjC interface declarations.
- virtual void ProcessFieldDecls(SourceLocation RecLoc, DeclTy *TagDecl,
+ virtual void ActOnFields(SourceLocation RecLoc, DeclTy *TagDecl,
DeclTy **Fields, unsigned NumFields,
tok::ObjCKeywordKind *visibility = 0);
- virtual DeclTy *ParseEnumConstant(Scope *S, DeclTy *EnumDecl,
+ virtual DeclTy *ActOnEnumConstant(Scope *S, DeclTy *EnumDecl,
DeclTy *LastEnumConstant,
SourceLocation IdLoc, IdentifierInfo *Id,
SourceLocation EqualLoc, ExprTy *Val);
- virtual void ParseEnumBody(SourceLocation EnumLoc, DeclTy *EnumDecl,
+ virtual void ActOnEnumBody(SourceLocation EnumLoc, DeclTy *EnumDecl,
DeclTy **Elements, unsigned NumElements);
private:
- /// Subroutines of ParseDeclarator()...
+ /// Subroutines of ActOnDeclarator()...
TypedefDecl *ParseTypedefDecl(Scope *S, Declarator &D, ScopedDecl *LastDecl);
TypedefDecl *MergeTypeDefDecl(TypedefDecl *New, ScopedDecl *Old);
FunctionDecl *MergeFunctionDecl(FunctionDecl *New, ScopedDecl *Old);
// Expression Parsing Callbacks: SemaExpr.cpp.
// Primary Expressions.
- virtual ExprResult ParseIdentifierExpr(Scope *S, SourceLocation Loc,
+ virtual ExprResult ActOnIdentifierExpr(Scope *S, SourceLocation Loc,
IdentifierInfo &II,
bool HasTrailingLParen);
virtual ExprResult ParsePreDefinedExpr(SourceLocation Loc,
}
Sema::DeclTy *
-Sema::ParseDeclarator(Scope *S, Declarator &D, DeclTy *lastDecl) {
+Sema::ActOnDeclarator(Scope *S, Declarator &D, DeclTy *lastDecl) {
ScopedDecl *LastDeclarator = dyn_cast_or_null<ScopedDecl>((Decl *)lastDecl);
IdentifierInfo *II = D.getIdentifier();
Scope *GlobalScope = FnBodyScope->getParent();
FunctionDecl *FD =
- static_cast<FunctionDecl*>(ParseDeclarator(GlobalScope, D, 0));
+ static_cast<FunctionDecl*>(ActOnDeclarator(GlobalScope, D, 0));
CurFunctionDecl = FD;
// Create Decl objects for each parameter, adding them to the FunctionDecl.
while (S->getParent())
S = S->getParent();
- return static_cast<Decl*>(ParseDeclarator(S, D, 0));
+ return static_cast<Decl*>(ActOnDeclarator(S, D, 0));
}
}
-/// ParseTag - This is invoked when we see 'struct foo' or 'struct {'. In the
+/// ActOnTag - This is invoked when we see 'struct foo' or 'struct {'. In the
/// former case, Name will be non-null. In the later case, Name will be null.
/// TagType indicates what kind of tag this is. TK indicates whether this is a
/// reference/declaration/definition of a tag.
-Sema::DeclTy *Sema::ParseTag(Scope *S, unsigned TagType, TagKind TK,
+Sema::DeclTy *Sema::ActOnTag(Scope *S, unsigned TagType, TagKind TK,
SourceLocation KWLoc, IdentifierInfo *Name,
SourceLocation NameLoc, AttributeList *Attr) {
// If this is a use of an existing tag, it must have a name.
return New;
}
-/// ParseField - Each field of a struct/union/class is passed into this in order
+/// ActOnField - Each field of a struct/union/class is passed into this in order
/// to create a FieldDecl object for it.
-Sema::DeclTy *Sema::ParseField(Scope *S, DeclTy *TagDecl,
+Sema::DeclTy *Sema::ActOnField(Scope *S, DeclTy *TagDecl,
SourceLocation DeclStart,
Declarator &D, ExprTy *BitfieldWidth) {
IdentifierInfo *II = D.getIdentifier();
else if (isa<ObjcInterfaceDecl>(static_cast<Decl *>(TagDecl)))
NewFD = new ObjcIvarDecl(Loc, II, T);
else
- assert(0 && "Sema::ParseField(): Unknown TagDecl");
+ assert(0 && "Sema::ActOnField(): Unknown TagDecl");
if (D.getInvalidType() || InvalidDecl)
NewFD->setInvalidDecl();
}
}
-void Sema::ProcessFieldDecls(SourceLocation RecLoc, DeclTy *RecDecl,
- DeclTy **Fields, unsigned NumFields,
- tok::ObjCKeywordKind *visibility) {
+void Sema::ActOnFields(SourceLocation RecLoc, DeclTy *RecDecl,
+ DeclTy **Fields, unsigned NumFields,
+ tok::ObjCKeywordKind *visibility) {
Decl *EnclosingDecl = static_cast<Decl*>(RecDecl);
assert(EnclosingDecl && "missing record or interface decl");
RecordDecl *Record = dyn_cast<RecordDecl>(EnclosingDecl);
AttrList, MethodType == tok::minus);
}
-Sema::DeclTy *Sema::ParseEnumConstant(Scope *S, DeclTy *theEnumDecl,
+Sema::DeclTy *Sema::ActOnEnumConstant(Scope *S, DeclTy *theEnumDecl,
DeclTy *lastEnumConst,
SourceLocation IdLoc, IdentifierInfo *Id,
SourceLocation EqualLoc, ExprTy *val) {
return New;
}
-void Sema::ParseEnumBody(SourceLocation EnumLoc, DeclTy *EnumDeclX,
+void Sema::ActOnEnumBody(SourceLocation EnumLoc, DeclTy *EnumDeclX,
DeclTy **Elements, unsigned NumElements) {
EnumDecl *Enum = cast<EnumDecl>(static_cast<Decl*>(EnumDeclX));
assert(!Enum->isDefinition() && "Enum redefinitions can't reach here");
}
-/// ParseIdentifierExpr - The parser read an identifier in expression context,
+/// ActOnIdentifierExpr - The parser read an identifier in expression context,
/// validate it per-C99 6.5.1. HasTrailingLParen indicates whether this
/// identifier is used in an function call context.
-Sema::ExprResult Sema::ParseIdentifierExpr(Scope *S, SourceLocation Loc,
+Sema::ExprResult Sema::ActOnIdentifierExpr(Scope *S, SourceLocation Loc,
IdentifierInfo &II,
bool HasTrailingLParen) {
// Could be enum-constant or decl.
SourceLocation RBraceLoc) {
Expr **InitList = reinterpret_cast<Expr**>(initlist);
- // Semantic analysis for initializers is done by ParseDeclarator() and
+ // Semantic analysis for initializers is done by ActOnDeclarator() and
// CheckInitializer() - it requires knowledge of the object being intialized.
InitListExpr *e = new InitListExpr(LBraceLoc, InitList, NumInit, RBraceLoc);
Sema::CheckSingleAssignmentConstraints(QualType lhsType, Expr *&rExpr) {
// This check seems unnatural, however it is necessary to insure the proper
// conversion of functions/arrays. If the conversion were done for all
- // DeclExpr's (created by ParseIdentifierExpr), it would mess up the unary
+ // DeclExpr's (created by ActOnIdentifierExpr), it would mess up the unary
// expressions that surpress this implicit conversion (&, sizeof).
DefaultFunctionArrayConversion(rExpr);
return T;
}
-Sema::TypeResult Sema::ParseTypeName(Scope *S, Declarator &D) {
+Sema::TypeResult Sema::ActOnTypeName(Scope *S, Declarator &D) {
// C99 6.7.6: Type names have no identifier. This is already validated by
// the parser.
assert(D.getIdentifier() == 0 && "Type name should have no identifier!");
}
// Called from Parser::ParseParenDeclarator().
-Sema::TypeResult Sema::ParseParamDeclaratorType(Scope *S, Declarator &D) {
+Sema::TypeResult Sema::ActOnParamDeclaratorType(Scope *S, Declarator &D) {
// Note: parameters have identifiers, but we don't care about them here, we
// just want the type converted.
QualType T = GetTypeForDeclarator(D, S);
08FB7793FE84155DC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "clang" */;
- compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1;
mainGroup = 08FB7794FE84155DC02AAC07 /* clang */;
projectDirPath = "";
};
-/// FieldDecl - An instance of this class is created by Sema::ParseField to
+/// FieldDecl - An instance of this class is created by Sema::ActOnField to
/// represent a member of a struct/union/class.
class FieldDecl : public Decl {
/// Identifier - The identifier for this declaration (e.g. the name for the
/// in the current scope.
virtual DeclTy *isTypeName(const IdentifierInfo &II, Scope *S) const = 0;
- /// ParseDeclarator - This callback is invoked when a declarator is parsed and
+ /// ActOnDeclarator - This callback is invoked when a declarator is parsed and
/// 'Init' specifies the initializer if any. This is for things like:
/// "int X = 4" or "typedef int foo".
///
/// LastInGroup is non-null for cases where one declspec has multiple
- /// declarators on it. For example in 'int A, B', ParseDeclarator will be
+ /// declarators on it. For example in 'int A, B', ActOnDeclarator will be
/// called with LastInGroup=A when invoked for B.
- virtual DeclTy *ParseDeclarator(Scope *S, Declarator &D,DeclTy *LastInGroup) {
+ virtual DeclTy *ActOnDeclarator(Scope *S, Declarator &D,DeclTy *LastInGroup) {
return 0;
}
/// ParseDeclarator (when an initializer is present). The code is factored
/// this way to make sure we are able to handle the following:
/// void func() { int xx = xx; }
- /// This allows ParseDeclarator to register "xx" prior to parsing the
+ /// This allows ActOnDeclarator to register "xx" prior to parsing the
/// initializer. The declaration above should still result in a warning,
/// since the reference to "xx" is uninitialized.
virtual void AddInitializerToDecl(DeclTy *Dcl, ExprTy *Init) {
}
/// ParseStartOfFunctionDef - This is called at the start of a function
- /// definition, instead of calling ParseDeclarator. The Declarator includes
+ /// definition, instead of calling ActOnDeclarator. The Declarator includes
/// information about formal arguments that are part of this function.
virtual DeclTy *ParseStartOfFunctionDef(Scope *FnBodyScope, Declarator &D) {
- // Default to ParseDeclarator.
- return ParseDeclarator(FnBodyScope, D, 0);
+ // Default to ActOnDeclarator.
+ return ActOnDeclarator(FnBodyScope, D, 0);
}
/// ParseFunctionDefBody - This is called when a function body has completed
// Type Parsing Callbacks.
//===--------------------------------------------------------------------===//
- virtual TypeResult ParseTypeName(Scope *S, Declarator &D) {
+ virtual TypeResult ActOnTypeName(Scope *S, Declarator &D) {
return 0;
}
- virtual TypeResult ParseParamDeclaratorType(Scope *S, Declarator &D) {
+ virtual TypeResult ActOnParamDeclaratorType(Scope *S, Declarator &D) {
return 0;
}
TK_Declaration, // Fwd decl of a tag: 'struct foo;'
TK_Definition // Definition of a tag: 'struct foo { int X; } Y;'
};
- virtual DeclTy *ParseTag(Scope *S, unsigned TagType, TagKind TK,
+ virtual DeclTy *ActOnTag(Scope *S, unsigned TagType, TagKind TK,
SourceLocation KWLoc, IdentifierInfo *Name,
SourceLocation NameLoc, AttributeList *Attr) {
// TagType is an instance of DeclSpec::TST, indicating what kind of tag this
return 0;
}
- virtual DeclTy *ParseField(Scope *S, DeclTy *TagDecl,SourceLocation DeclStart,
+ virtual DeclTy *ActOnField(Scope *S, DeclTy *TagDecl,SourceLocation DeclStart,
Declarator &D, ExprTy *BitfieldWidth) {
return 0;
}
- virtual void ProcessFieldDecls(SourceLocation RecLoc, DeclTy *TagDecl,
+ virtual void ActOnFields(SourceLocation RecLoc, DeclTy *TagDecl,
DeclTy **Fields, unsigned NumFields,
tok::ObjCKeywordKind *visibility = 0) {}
- virtual DeclTy *ParseEnumConstant(Scope *S, DeclTy *EnumDecl,
+ virtual DeclTy *ActOnEnumConstant(Scope *S, DeclTy *EnumDecl,
DeclTy *LastEnumConstant,
SourceLocation IdLoc, IdentifierInfo *Id,
SourceLocation EqualLoc, ExprTy *Val) {
return 0;
}
- virtual void ParseEnumBody(SourceLocation EnumLoc, DeclTy *EnumDecl,
+ virtual void ActOnEnumBody(SourceLocation EnumLoc, DeclTy *EnumDecl,
DeclTy **Elements, unsigned NumElements) {}
//===--------------------------------------------------------------------===//
// Primary Expressions.
- /// ParseIdentifierExpr - Parse an identifier in expression context.
+ /// ActOnIdentifierExpr - Parse an identifier in expression context.
/// 'HasTrailingLParen' indicates whether or not the identifier has a '('
/// token immediately after it.
- virtual ExprResult ParseIdentifierExpr(Scope *S, SourceLocation Loc,
+ virtual ExprResult ActOnIdentifierExpr(Scope *S, SourceLocation Loc,
IdentifierInfo &II,
bool HasTrailingLParen) {
return 0;
/// determine whether the name is a typedef or not in this scope.
virtual DeclTy *isTypeName(const IdentifierInfo &II, Scope *S) const;
- /// ParseDeclarator - If this is a typedef declarator, we modify the
+ /// ActOnDeclarator - If this is a typedef declarator, we modify the
/// IdentifierInfo::FETokenInfo field to keep track of this fact, until S is
/// popped.
- virtual DeclTy *ParseDeclarator(Scope *S, Declarator &D, DeclTy *LastInGroup);
+ virtual DeclTy *ActOnDeclarator(Scope *S, Declarator &D, DeclTy *LastInGroup);
/// PopScope - When a scope is popped, if any typedefs are now out-of-scope,
/// they are removed from the IdentifierInfo::FETokenInfo field.
// FIXME: before we delete the vector, we need to make sure the Expr's
// have been deleted. Since Action::ExprTy is "void", we are dependent
// on the actions module for actually freeing the memory. The specific
- // hooks are ParseDeclarator, ParseTypeName, ParseParamDeclaratorType,
+ // hooks are ActOnDeclarator, ActOnTypeName, ActOnParamDeclaratorType,
// ParseField, ParseTag. Once these routines have freed the expression,
// they should zero out the Args slot (to indicate the memory has been
// freed). If any element of the vector is non-null, we should assert.