2006-08-17 13:51:27 +08:00
|
|
|
//===--- PrintParserActions.cpp - Implement -parse-print-callbacks mode ---===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-30 03:59:25 +08:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2006-08-17 13:51:27 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This code simply runs the preprocessor on the input file and prints out the
|
|
|
|
// result. This is the traditional behavior of the -E option.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "clang.h"
|
|
|
|
#include "clang/Parse/Action.h"
|
2006-11-12 07:03:42 +08:00
|
|
|
#include "clang/Parse/DeclSpec.h"
|
2008-01-15 00:44:48 +08:00
|
|
|
#include "llvm/Support/Streams.h"
|
2006-08-17 13:51:27 +08:00
|
|
|
using namespace clang;
|
|
|
|
|
|
|
|
namespace {
|
2006-11-06 02:44:26 +08:00
|
|
|
class ParserPrintActions : public MinimalAction {
|
2006-08-17 13:51:27 +08:00
|
|
|
|
2007-11-01 04:55:39 +08:00
|
|
|
public:
|
2008-10-31 16:56:51 +08:00
|
|
|
ParserPrintActions(Preprocessor &PP) : MinimalAction(PP) {}
|
2008-08-01 08:41:12 +08:00
|
|
|
|
|
|
|
// Printing Functions which also must call MinimalAction
|
|
|
|
|
2007-09-16 02:49:24 +08:00
|
|
|
/// ActOnDeclarator - This callback is invoked when a declarator is parsed
|
2006-10-16 08:33:54 +08:00
|
|
|
/// and 'Init' specifies the initializer if any. This is for things like:
|
2006-08-17 13:51:27 +08:00
|
|
|
/// "int X = 4" or "typedef int foo".
|
2007-09-16 02:49:24 +08:00
|
|
|
virtual DeclTy *ActOnDeclarator(Scope *S, Declarator &D,
|
2008-08-06 00:28:08 +08:00
|
|
|
DeclTy *LastInGroup) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << " ";
|
2006-08-17 13:51:27 +08:00
|
|
|
if (IdentifierInfo *II = D.getIdentifier()) {
|
2008-01-15 00:44:48 +08:00
|
|
|
llvm::cout << "'" << II->getName() << "'";
|
2006-08-17 13:51:27 +08:00
|
|
|
} else {
|
2008-01-15 00:44:48 +08:00
|
|
|
llvm::cout << "<anon>";
|
2006-08-17 13:51:27 +08:00
|
|
|
}
|
2008-01-15 00:44:48 +08:00
|
|
|
llvm::cout << "\n";
|
2006-08-17 13:51:27 +08:00
|
|
|
|
|
|
|
// Pass up to EmptyActions so that the symbol table is maintained right.
|
2008-08-06 00:28:08 +08:00
|
|
|
return MinimalAction::ActOnDeclarator(S, D, LastInGroup);
|
2006-08-17 13:51:27 +08:00
|
|
|
}
|
2007-10-11 01:45:44 +08:00
|
|
|
/// ActOnPopScope - This callback is called immediately before the specified
|
|
|
|
/// scope is popped and deleted.
|
|
|
|
virtual void ActOnPopScope(SourceLocation Loc, Scope *S) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
|
|
|
return MinimalAction::ActOnPopScope(Loc, S);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// ActOnTranslationUnitScope - This callback is called once, immediately
|
|
|
|
/// after creating the translation unit scope (in Parser::Initialize).
|
|
|
|
virtual void ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) {
|
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
|
|
|
MinimalAction::ActOnTranslationUnitScope(Loc, S);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Action::DeclTy *ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
|
|
|
|
IdentifierInfo *ClassName,
|
|
|
|
SourceLocation ClassLoc,
|
|
|
|
IdentifierInfo *SuperName,
|
|
|
|
SourceLocation SuperLoc,
|
|
|
|
DeclTy * const *ProtoRefs,
|
|
|
|
unsigned NumProtocols,
|
|
|
|
SourceLocation EndProtoLoc,
|
|
|
|
AttributeList *AttrList) {
|
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
|
|
|
return MinimalAction::ActOnStartClassInterface(AtInterfaceLoc,
|
|
|
|
ClassName, ClassLoc,
|
|
|
|
SuperName, SuperLoc,
|
|
|
|
ProtoRefs, NumProtocols,
|
|
|
|
EndProtoLoc, AttrList);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// ActOnForwardClassDeclaration -
|
|
|
|
/// Scope will always be top level file scope.
|
|
|
|
Action::DeclTy *ActOnForwardClassDeclaration(SourceLocation AtClassLoc,
|
|
|
|
IdentifierInfo **IdentList,
|
|
|
|
unsigned NumElts) {
|
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
|
|
|
return MinimalAction::ActOnForwardClassDeclaration(AtClassLoc, IdentList,
|
|
|
|
NumElts);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Pure Printing
|
|
|
|
|
|
|
|
/// ActOnParamDeclarator - This callback is invoked when a parameter
|
|
|
|
/// declarator is parsed. This callback only occurs for functions
|
|
|
|
/// with prototypes. S is the function prototype scope for the
|
|
|
|
/// parameters (C++ [basic.scope.proto]).
|
|
|
|
virtual DeclTy *ActOnParamDeclarator(Scope *S, Declarator &D) {
|
|
|
|
llvm::cout << __FUNCTION__ << " ";
|
|
|
|
if (IdentifierInfo *II = D.getIdentifier()) {
|
|
|
|
llvm::cout << "'" << II->getName() << "'";
|
|
|
|
} else {
|
|
|
|
llvm::cout << "<anon>";
|
|
|
|
}
|
|
|
|
llvm::cout << "\n";
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// AddInitializerToDecl - This action is called immediately after
|
|
|
|
/// 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 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.
|
2008-12-14 00:23:55 +08:00
|
|
|
virtual void AddInitializerToDecl(DeclTy *Dcl, ExprArg Init) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
/// FinalizeDeclaratorGroup - After a sequence of declarators are parsed, this
|
|
|
|
/// gives the actions implementation a chance to process the group as a whole.
|
|
|
|
virtual DeclTy *FinalizeDeclaratorGroup(Scope *S, DeclTy *Group) {
|
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// ActOnStartOfFunctionDef - This is called at the start of a function
|
|
|
|
/// definition, instead of calling ActOnDeclarator. The Declarator includes
|
|
|
|
/// information about formal arguments that are part of this function.
|
|
|
|
virtual DeclTy *ActOnStartOfFunctionDef(Scope *FnBodyScope, Declarator &D) {
|
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// ActOnStartOfFunctionDef - This is called at the start of a function
|
|
|
|
/// definition, after the FunctionDecl has already been created.
|
|
|
|
virtual DeclTy *ActOnStartOfFunctionDef(Scope *FnBodyScope, DeclTy *D) {
|
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void ObjCActOnStartOfMethodDef(Scope *FnBodyScope, DeclTy *D) {
|
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
/// ActOnFunctionDefBody - This is called when a function body has completed
|
|
|
|
/// parsing. Decl is the DeclTy returned by ParseStartOfFunctionDef.
|
2008-12-14 00:23:55 +08:00
|
|
|
virtual DeclTy *ActOnFinishFunctionBody(DeclTy *Decl, StmtArg Body) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-12-14 00:23:55 +08:00
|
|
|
virtual DeclTy *ActOnFileScopeAsmDecl(SourceLocation Loc, ExprArg AsmString) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with
|
|
|
|
/// no declarator (e.g. "struct foo;") is parsed.
|
|
|
|
virtual DeclTy *ParsedFreeStandingDeclSpec(Scope *S, DeclSpec &DS) {
|
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
|
|
|
return 0;
|
|
|
|
}
|
2008-12-17 09:46:43 +08:00
|
|
|
|
|
|
|
/// ActOnLinkageSpec - Parsed a C++ linkage-specification that
|
|
|
|
/// contained braces. Lang/StrSize contains the language string that
|
|
|
|
/// was parsed at location Loc. Decls/NumDecls provides the
|
|
|
|
/// declarations parsed inside the linkage specification.
|
2008-08-01 08:41:12 +08:00
|
|
|
virtual DeclTy *ActOnLinkageSpec(SourceLocation Loc, SourceLocation LBrace,
|
|
|
|
SourceLocation RBrace, const char *Lang,
|
2008-12-17 09:46:43 +08:00
|
|
|
unsigned StrSize,
|
|
|
|
DeclTy **Decls, unsigned NumDecls) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
|
|
|
return 0;
|
|
|
|
}
|
2008-12-17 09:46:43 +08:00
|
|
|
|
|
|
|
/// ActOnLinkageSpec - Parsed a C++ linkage-specification without
|
|
|
|
/// braces. Lang/StrSize contains the language string that was
|
|
|
|
/// parsed at location Loc. D is the declaration parsed.
|
|
|
|
virtual DeclTy *ActOnLinkageSpec(SourceLocation Loc, const char *Lang,
|
|
|
|
unsigned StrSize, DeclTy *D) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-08-01 08:41:12 +08:00
|
|
|
//===--------------------------------------------------------------------===//
|
|
|
|
// Type Parsing Callbacks.
|
|
|
|
//===--------------------------------------------------------------------===//
|
|
|
|
|
2008-12-02 22:43:59 +08:00
|
|
|
virtual TypeResult ActOnTypeName(Scope *S, Declarator &D) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual DeclTy *ActOnTag(Scope *S, unsigned TagType, TagKind TK,
|
2008-11-09 00:45:02 +08:00
|
|
|
SourceLocation KWLoc, const CXXScopeSpec &SS,
|
|
|
|
IdentifierInfo *Name, SourceLocation NameLoc,
|
2009-02-07 06:42:48 +08:00
|
|
|
AttributeList *Attr) {
|
2008-08-01 08:41:12 +08:00
|
|
|
// TagType is an instance of DeclSpec::TST, indicating what kind of tag this
|
|
|
|
// is (struct/union/enum/class).
|
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Act on @defs() element found when parsing a structure. ClassName is the
|
|
|
|
/// name of the referenced class.
|
2008-12-12 00:49:14 +08:00
|
|
|
virtual void ActOnDefs(Scope *S, DeclTy *TagD, SourceLocation DeclStart,
|
2008-08-01 08:41:12 +08:00
|
|
|
IdentifierInfo *ClassName,
|
|
|
|
llvm::SmallVectorImpl<DeclTy*> &Decls) {
|
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
|
|
|
}
|
|
|
|
|
2008-12-12 00:49:14 +08:00
|
|
|
virtual DeclTy *ActOnField(Scope *S, DeclTy *TagD,
|
|
|
|
SourceLocation DeclStart,
|
2008-08-01 08:41:12 +08:00
|
|
|
Declarator &D, ExprTy *BitfieldWidth) {
|
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual DeclTy *ActOnIvar(Scope *S, SourceLocation DeclStart,
|
|
|
|
Declarator &D, ExprTy *BitfieldWidth,
|
|
|
|
tok::ObjCKeywordKind visibility) {
|
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void ActOnFields(Scope* S, SourceLocation RecLoc, DeclTy *TagDecl,
|
|
|
|
DeclTy **Fields, unsigned NumFields,
|
2008-10-03 10:03:53 +08:00
|
|
|
SourceLocation LBrac, SourceLocation RBrac,
|
|
|
|
AttributeList *AttrList) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual DeclTy *ActOnEnumConstant(Scope *S, DeclTy *EnumDecl,
|
|
|
|
DeclTy *LastEnumConstant,
|
|
|
|
SourceLocation IdLoc, IdentifierInfo *Id,
|
|
|
|
SourceLocation EqualLoc, ExprTy *Val) {
|
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void ActOnEnumBody(SourceLocation EnumLoc, DeclTy *EnumDecl,
|
|
|
|
DeclTy **Elements, unsigned NumElements) {
|
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
//===--------------------------------------------------------------------===//
|
|
|
|
// Statement Parsing Callbacks.
|
|
|
|
//===--------------------------------------------------------------------===//
|
2008-12-21 20:04:03 +08:00
|
|
|
|
|
|
|
virtual OwningStmtResult ActOnNullStmt(SourceLocation SemiLoc) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2008-12-21 20:04:03 +08:00
|
|
|
return StmtEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
2008-12-21 20:04:03 +08:00
|
|
|
|
|
|
|
virtual OwningStmtResult ActOnCompoundStmt(SourceLocation L,
|
|
|
|
SourceLocation R,
|
|
|
|
MultiStmtArg Elts,
|
|
|
|
bool isStmtExpr) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2008-12-21 20:04:03 +08:00
|
|
|
return StmtEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
2008-12-21 20:04:03 +08:00
|
|
|
virtual OwningStmtResult ActOnDeclStmt(DeclTy *Decl,
|
|
|
|
SourceLocation StartLoc,
|
|
|
|
SourceLocation EndLoc) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2008-12-21 20:04:03 +08:00
|
|
|
return StmtEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
|
|
|
|
2008-12-21 20:04:03 +08:00
|
|
|
virtual OwningStmtResult ActOnExprStmt(ExprArg Expr) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2008-12-21 20:04:03 +08:00
|
|
|
return OwningStmtResult(*this, Expr.release());
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/// ActOnCaseStmt - Note that this handles the GNU 'case 1 ... 4' extension,
|
|
|
|
/// which can specify an RHS value.
|
2008-12-29 00:13:43 +08:00
|
|
|
virtual OwningStmtResult ActOnCaseStmt(SourceLocation CaseLoc,
|
|
|
|
ExprArg LHSVal,
|
|
|
|
SourceLocation DotDotDotLoc,
|
|
|
|
ExprArg RHSVal,
|
|
|
|
SourceLocation ColonLoc,
|
|
|
|
StmtArg SubStmt) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2008-12-29 00:13:43 +08:00
|
|
|
return StmtEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
2008-12-29 00:13:43 +08:00
|
|
|
virtual OwningStmtResult ActOnDefaultStmt(SourceLocation DefaultLoc,
|
|
|
|
SourceLocation ColonLoc,
|
|
|
|
StmtArg SubStmt, Scope *CurScope){
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2008-12-29 00:13:43 +08:00
|
|
|
return StmtEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
2009-01-11 08:38:46 +08:00
|
|
|
|
|
|
|
virtual OwningStmtResult ActOnLabelStmt(SourceLocation IdentLoc,
|
|
|
|
IdentifierInfo *II,
|
|
|
|
SourceLocation ColonLoc,
|
|
|
|
StmtArg SubStmt) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2009-01-11 08:38:46 +08:00
|
|
|
return StmtEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
2009-01-11 08:38:46 +08:00
|
|
|
|
|
|
|
virtual OwningStmtResult ActOnIfStmt(SourceLocation IfLoc, ExprArg CondVal,
|
|
|
|
StmtArg ThenVal,SourceLocation ElseLoc,
|
|
|
|
StmtArg ElseVal) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2009-01-11 08:38:46 +08:00
|
|
|
return StmtEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
2009-01-11 08:38:46 +08:00
|
|
|
|
|
|
|
virtual OwningStmtResult ActOnStartOfSwitchStmt(ExprArg Cond) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2009-01-11 08:38:46 +08:00
|
|
|
return StmtEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
2009-01-11 08:38:46 +08:00
|
|
|
|
|
|
|
virtual OwningStmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc,
|
|
|
|
StmtArg Switch,
|
|
|
|
StmtArg Body) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2009-01-11 08:38:46 +08:00
|
|
|
return StmtEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
|
|
|
|
2009-01-17 07:28:06 +08:00
|
|
|
virtual OwningStmtResult ActOnWhileStmt(SourceLocation WhileLoc,
|
|
|
|
ExprArg Cond, StmtArg Body) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2009-01-17 07:28:06 +08:00
|
|
|
return StmtEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
2009-01-17 07:28:06 +08:00
|
|
|
virtual OwningStmtResult ActOnDoStmt(SourceLocation DoLoc, StmtArg Body,
|
|
|
|
SourceLocation WhileLoc, ExprArg Cond){
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2009-01-17 07:28:06 +08:00
|
|
|
return StmtEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
2009-01-17 07:28:06 +08:00
|
|
|
virtual OwningStmtResult ActOnForStmt(SourceLocation ForLoc,
|
|
|
|
SourceLocation LParenLoc,
|
|
|
|
StmtArg First, ExprArg Second,
|
|
|
|
ExprArg Third, SourceLocation RParenLoc,
|
|
|
|
StmtArg Body) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2009-01-17 07:28:06 +08:00
|
|
|
return StmtEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
2009-01-17 07:28:06 +08:00
|
|
|
virtual OwningStmtResult ActOnObjCForCollectionStmt(
|
|
|
|
SourceLocation ForColLoc,
|
|
|
|
SourceLocation LParenLoc,
|
|
|
|
StmtArg First, ExprArg Second,
|
|
|
|
SourceLocation RParenLoc, StmtArg Body) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2009-01-17 07:28:06 +08:00
|
|
|
return StmtEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
2009-01-18 21:19:59 +08:00
|
|
|
virtual OwningStmtResult ActOnGotoStmt(SourceLocation GotoLoc,
|
|
|
|
SourceLocation LabelLoc,
|
|
|
|
IdentifierInfo *LabelII) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2009-01-18 21:19:59 +08:00
|
|
|
return StmtEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
2009-01-18 21:19:59 +08:00
|
|
|
virtual OwningStmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc,
|
|
|
|
SourceLocation StarLoc,
|
|
|
|
ExprArg DestExp) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2009-01-18 21:19:59 +08:00
|
|
|
return StmtEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
2009-01-18 21:19:59 +08:00
|
|
|
virtual OwningStmtResult ActOnContinueStmt(SourceLocation ContinueLoc,
|
|
|
|
Scope *CurScope) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2009-01-18 21:19:59 +08:00
|
|
|
return StmtEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
2009-01-18 21:19:59 +08:00
|
|
|
virtual OwningStmtResult ActOnBreakStmt(SourceLocation GotoLoc,
|
|
|
|
Scope *CurScope) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2009-01-18 21:19:59 +08:00
|
|
|
return StmtEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
2009-01-18 21:19:59 +08:00
|
|
|
virtual OwningStmtResult ActOnReturnStmt(SourceLocation ReturnLoc,
|
|
|
|
ExprArg RetValExp) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2009-01-18 21:19:59 +08:00
|
|
|
return StmtEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
2009-01-19 00:53:17 +08:00
|
|
|
virtual OwningStmtResult ActOnAsmStmt(SourceLocation AsmLoc,
|
|
|
|
bool IsSimple,
|
|
|
|
bool IsVolatile,
|
|
|
|
unsigned NumOutputs,
|
|
|
|
unsigned NumInputs,
|
|
|
|
std::string *Names,
|
|
|
|
MultiExprArg Constraints,
|
|
|
|
MultiExprArg Exprs,
|
|
|
|
ExprArg AsmString,
|
|
|
|
MultiExprArg Clobbers,
|
|
|
|
SourceLocation RParenLoc) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2009-01-19 00:53:17 +08:00
|
|
|
return StmtEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
2009-01-19 00:53:17 +08:00
|
|
|
|
2008-08-01 08:41:12 +08:00
|
|
|
// Objective-c statements
|
2009-01-19 01:43:11 +08:00
|
|
|
virtual OwningStmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc,
|
|
|
|
SourceLocation RParen,
|
|
|
|
StmtArg Parm, StmtArg Body,
|
|
|
|
StmtArg CatchList) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2009-01-19 01:43:11 +08:00
|
|
|
return StmtEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
2009-01-19 01:43:11 +08:00
|
|
|
|
|
|
|
virtual OwningStmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc,
|
|
|
|
StmtArg Body) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2009-01-19 01:43:11 +08:00
|
|
|
return StmtEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
2009-01-19 01:43:11 +08:00
|
|
|
|
|
|
|
virtual OwningStmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc,
|
|
|
|
StmtArg Try, StmtArg Catch,
|
|
|
|
StmtArg Finally) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2009-01-19 01:43:11 +08:00
|
|
|
return StmtEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
2009-01-19 01:43:11 +08:00
|
|
|
|
|
|
|
virtual OwningStmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc,
|
2009-02-12 04:05:44 +08:00
|
|
|
ExprArg Throw,
|
|
|
|
Scope *CurScope) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2009-01-19 01:43:11 +08:00
|
|
|
return StmtEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
2009-01-19 01:43:11 +08:00
|
|
|
|
|
|
|
virtual OwningStmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc,
|
|
|
|
ExprArg SynchExpr,
|
|
|
|
StmtArg SynchBody) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2009-01-19 01:43:11 +08:00
|
|
|
return StmtEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
2008-12-22 00:41:36 +08:00
|
|
|
|
|
|
|
// C++ Statements
|
|
|
|
virtual DeclTy *ActOnExceptionDeclarator(Scope *S, Declarator &D) {
|
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual OwningStmtResult ActOnCXXCatchBlock(SourceLocation CatchLoc,
|
|
|
|
DeclTy *ExceptionDecl,
|
|
|
|
StmtArg HandlerBlock) {
|
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
|
|
|
return StmtEmpty();
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual OwningStmtResult ActOnCXXTryBlock(SourceLocation TryLoc,
|
|
|
|
StmtArg TryBlock,
|
|
|
|
MultiStmtArg Handlers) {
|
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
|
|
|
return StmtEmpty();
|
|
|
|
}
|
|
|
|
|
2008-08-01 08:41:12 +08:00
|
|
|
//===--------------------------------------------------------------------===//
|
|
|
|
// Expression Parsing Callbacks.
|
|
|
|
//===--------------------------------------------------------------------===//
|
2009-01-19 02:53:16 +08:00
|
|
|
|
2008-08-01 08:41:12 +08:00
|
|
|
// Primary Expressions.
|
2009-01-19 02:53:16 +08:00
|
|
|
|
2008-08-01 08:41:12 +08:00
|
|
|
/// ActOnIdentifierExpr - Parse an identifier in expression context.
|
|
|
|
/// 'HasTrailingLParen' indicates whether or not the identifier has a '('
|
|
|
|
/// token immediately after it.
|
2009-01-19 02:53:16 +08:00
|
|
|
virtual OwningExprResult ActOnIdentifierExpr(Scope *S, SourceLocation Loc,
|
|
|
|
IdentifierInfo &II,
|
|
|
|
bool HasTrailingLParen,
|
2009-02-04 04:19:35 +08:00
|
|
|
const CXXScopeSpec *SS,
|
|
|
|
bool isAddressOfOperand) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2009-01-19 02:53:16 +08:00
|
|
|
return ExprEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
2009-01-19 02:53:16 +08:00
|
|
|
|
|
|
|
virtual OwningExprResult ActOnCXXOperatorFunctionIdExpr(
|
|
|
|
Scope *S, SourceLocation OperatorLoc,
|
|
|
|
OverloadedOperatorKind Op,
|
2009-02-04 04:19:35 +08:00
|
|
|
bool HasTrailingLParen, const CXXScopeSpec &SS,
|
|
|
|
bool isAddressOfOperand) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2009-01-19 02:53:16 +08:00
|
|
|
return ExprEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
|
|
|
|
2009-01-19 02:53:16 +08:00
|
|
|
virtual OwningExprResult ActOnCXXConversionFunctionExpr(
|
|
|
|
Scope *S, SourceLocation OperatorLoc,
|
|
|
|
TypeTy *Type, bool HasTrailingLParen,
|
2009-02-04 04:19:35 +08:00
|
|
|
const CXXScopeSpec &SS,bool isAddressOfOperand) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2009-01-19 02:53:16 +08:00
|
|
|
return ExprEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
|
|
|
|
2009-01-19 02:53:16 +08:00
|
|
|
virtual OwningExprResult ActOnPredefinedExpr(SourceLocation Loc,
|
|
|
|
tok::TokenKind Kind) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2009-01-19 02:53:16 +08:00
|
|
|
return ExprEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
2009-01-19 02:53:16 +08:00
|
|
|
|
|
|
|
virtual OwningExprResult ActOnCharacterConstant(const Token &) {
|
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
|
|
|
return ExprEmpty();
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual OwningExprResult ActOnNumericConstant(const Token &) {
|
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
|
|
|
return ExprEmpty();
|
|
|
|
}
|
|
|
|
|
2008-08-01 08:41:12 +08:00
|
|
|
/// ActOnStringLiteral - The specified tokens were lexed as pasted string
|
|
|
|
/// fragments (e.g. "foo" "bar" L"baz").
|
2009-01-19 02:53:16 +08:00
|
|
|
virtual OwningExprResult ActOnStringLiteral(const Token *Toks,
|
|
|
|
unsigned NumToks) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2009-01-19 02:53:16 +08:00
|
|
|
return ExprEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
2009-01-19 02:53:16 +08:00
|
|
|
|
|
|
|
virtual OwningExprResult ActOnParenExpr(SourceLocation L, SourceLocation R,
|
|
|
|
ExprArg Val) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2009-02-05 23:02:23 +08:00
|
|
|
return move(Val); // Default impl returns operand.
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
2009-01-19 02:53:16 +08:00
|
|
|
|
2008-08-01 08:41:12 +08:00
|
|
|
// Postfix Expressions.
|
2009-01-19 08:08:26 +08:00
|
|
|
virtual OwningExprResult ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc,
|
|
|
|
tok::TokenKind Kind,
|
|
|
|
ExprArg Input) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2009-01-19 08:08:26 +08:00
|
|
|
return ExprEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
2009-01-19 08:08:26 +08:00
|
|
|
virtual OwningExprResult ActOnArraySubscriptExpr(Scope *S, ExprArg Base,
|
|
|
|
SourceLocation LLoc,
|
|
|
|
ExprArg Idx,
|
|
|
|
SourceLocation RLoc) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2009-01-19 08:08:26 +08:00
|
|
|
return ExprEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
2009-01-19 08:08:26 +08:00
|
|
|
virtual OwningExprResult ActOnMemberReferenceExpr(Scope *S, ExprArg Base,
|
|
|
|
SourceLocation OpLoc,
|
|
|
|
tok::TokenKind OpKind,
|
|
|
|
SourceLocation MemberLoc,
|
|
|
|
IdentifierInfo &Member) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2009-01-19 08:08:26 +08:00
|
|
|
return ExprEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
2009-01-19 08:08:26 +08:00
|
|
|
|
|
|
|
virtual OwningExprResult ActOnCallExpr(Scope *S, ExprArg Fn,
|
|
|
|
SourceLocation LParenLoc,
|
|
|
|
MultiExprArg Args,
|
|
|
|
SourceLocation *CommaLocs,
|
|
|
|
SourceLocation RParenLoc) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2009-01-19 08:08:26 +08:00
|
|
|
return ExprEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
2009-01-19 08:08:26 +08:00
|
|
|
|
2008-08-01 08:41:12 +08:00
|
|
|
// Unary Operators. 'Tok' is the token for the operator.
|
2009-01-19 08:08:26 +08:00
|
|
|
virtual OwningExprResult ActOnUnaryOp(Scope *S, SourceLocation OpLoc,
|
|
|
|
tok::TokenKind Op, ExprArg Input) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2009-01-19 08:08:26 +08:00
|
|
|
return ExprEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
2009-01-19 08:08:26 +08:00
|
|
|
virtual OwningExprResult
|
|
|
|
ActOnSizeOfAlignOfExpr(SourceLocation OpLoc, bool isSizeof, bool isType,
|
|
|
|
void *TyOrEx, const SourceRange &ArgRange) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2009-01-19 08:08:26 +08:00
|
|
|
return ExprEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
2009-01-20 06:31:54 +08:00
|
|
|
|
|
|
|
virtual OwningExprResult ActOnCompoundLiteral(SourceLocation LParen,
|
|
|
|
TypeTy *Ty,
|
|
|
|
SourceLocation RParen,
|
|
|
|
ExprArg Op) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2009-01-20 06:31:54 +08:00
|
|
|
return ExprEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
2009-01-20 06:31:54 +08:00
|
|
|
virtual OwningExprResult ActOnInitList(SourceLocation LParenLoc,
|
|
|
|
MultiExprArg InitList,
|
|
|
|
InitListDesignations &Designators,
|
|
|
|
SourceLocation RParenLoc) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2009-01-20 06:31:54 +08:00
|
|
|
return ExprEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
2009-01-20 06:31:54 +08:00
|
|
|
virtual OwningExprResult ActOnCastExpr(SourceLocation LParenLoc, TypeTy *Ty,
|
|
|
|
SourceLocation RParenLoc,ExprArg Op){
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2009-01-20 06:31:54 +08:00
|
|
|
return ExprEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
2009-01-20 06:31:54 +08:00
|
|
|
|
|
|
|
virtual OwningExprResult ActOnBinOp(Scope *S, SourceLocation TokLoc,
|
|
|
|
tok::TokenKind Kind,
|
|
|
|
ExprArg LHS, ExprArg RHS) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2009-01-20 06:31:54 +08:00
|
|
|
return ExprEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/// ActOnConditionalOp - Parse a ?: operation. Note that 'LHS' may be null
|
|
|
|
/// in the case of a the GNU conditional expr extension.
|
2009-01-20 06:31:54 +08:00
|
|
|
virtual OwningExprResult ActOnConditionalOp(SourceLocation QuestionLoc,
|
|
|
|
SourceLocation ColonLoc,
|
|
|
|
ExprArg Cond, ExprArg LHS,
|
|
|
|
ExprArg RHS) {
|
2008-08-01 08:41:12 +08:00
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
2009-01-20 06:31:54 +08:00
|
|
|
return ExprEmpty();
|
2008-08-01 08:41:12 +08:00
|
|
|
}
|
2009-01-20 06:31:54 +08:00
|
|
|
|
|
|
|
//===--------------------- GNU Extension Expressions ------------------===//
|
2008-08-01 08:41:12 +08:00
|
|
|
|
|
|
|
virtual ExprResult ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc,
|
|
|
|
IdentifierInfo *LabelII) { // "&&foo"
|
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ExprResult ActOnStmtExpr(SourceLocation LPLoc, StmtTy *SubStmt,
|
|
|
|
SourceLocation RPLoc) { // "({..})"
|
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-12-23 08:26:44 +08:00
|
|
|
virtual ExprResult ActOnBuiltinOffsetOf(Scope *S, SourceLocation BuiltinLoc,
|
2008-08-01 08:41:12 +08:00
|
|
|
SourceLocation TypeLoc, TypeTy *Arg1,
|
|
|
|
OffsetOfComponent *CompPtr,
|
|
|
|
unsigned NumComponents,
|
|
|
|
SourceLocation RParenLoc) {
|
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// __builtin_types_compatible_p(type1, type2)
|
|
|
|
virtual ExprResult ActOnTypesCompatibleExpr(SourceLocation BuiltinLoc,
|
|
|
|
TypeTy *arg1, TypeTy *arg2,
|
|
|
|
SourceLocation RPLoc) {
|
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
// __builtin_choose_expr(constExpr, expr1, expr2)
|
|
|
|
virtual ExprResult ActOnChooseExpr(SourceLocation BuiltinLoc,
|
|
|
|
ExprTy *cond, ExprTy *expr1, ExprTy *expr2,
|
|
|
|
SourceLocation RPLoc) {
|
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
// __builtin_overload(...)
|
|
|
|
virtual ExprResult ActOnOverloadExpr(ExprTy **Args, unsigned NumArgs,
|
|
|
|
SourceLocation *CommaLocs,
|
|
|
|
SourceLocation BuiltinLoc,
|
|
|
|
SourceLocation RPLoc) {
|
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// __builtin_va_arg(expr, type)
|
|
|
|
virtual ExprResult ActOnVAArg(SourceLocation BuiltinLoc,
|
|
|
|
ExprTy *expr, TypeTy *type,
|
|
|
|
SourceLocation RPLoc) {
|
|
|
|
llvm::cout << __FUNCTION__ << "\n";
|
|
|
|
return 0;
|
2006-08-17 13:51:27 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2008-10-31 16:56:51 +08:00
|
|
|
MinimalAction *clang::CreatePrintParserActionsAction(Preprocessor &PP) {
|
|
|
|
return new ParserPrintActions(PP);
|
2006-08-17 13:51:27 +08:00
|
|
|
}
|