zcov: / lib/Frontend/PrintParserCallbacks.cpp


Files: 1 Branches Taken: 50.0% 4 / 8
Generated: 2010-02-10 01:31 Branches Executed: 75.0% 6 / 8
Line Coverage: 64.7% 205 / 317


Programs: 1 Runs 2897


       1                 : //===--- PrintParserActions.cpp - Implement -parse-print-callbacks mode ---===//
       2                 : //
       3                 : //                     The LLVM Compiler Infrastructure
       4                 : //
       5                 : // This file is distributed under the University of Illinois Open Source
       6                 : // License. See LICENSE.TXT for details.
       7                 : //
       8                 : //===----------------------------------------------------------------------===//
       9                 : //
      10                 : // This code simply runs the preprocessor on the input file and prints out the
      11                 : // result.  This is the traditional behavior of the -E option.
      12                 : //
      13                 : //===----------------------------------------------------------------------===//
      14                 : 
      15                 : #include "clang/Frontend/Utils.h"
      16                 : #include "clang/Parse/Action.h"
      17                 : #include "clang/Parse/DeclSpec.h"
      18                 : #include "llvm/Support/raw_ostream.h"
      19                 : using namespace clang;
      20                 : 
      21                 : namespace {
                        2: branch 1 taken
                        0: branch 2 not taken
                        0: branch 5 not taken
                        0: branch 6 not taken
      22                2:   class ParserPrintActions : public MinimalAction {
      23                 :   llvm::raw_ostream& Out;
      24                 : 
      25                 :   public:
      26                2:     ParserPrintActions(Preprocessor &PP, llvm::raw_ostream& OS)
      27                2:       : MinimalAction(PP), Out(OS) {}
      28                 : 
      29                 :     // Printing Functions which also must call MinimalAction
      30                 : 
      31                 :     /// ActOnDeclarator - This callback is invoked when a declarator is parsed
      32                 :     /// and 'Init' specifies the initializer if any.  This is for things like:
      33                 :     /// "int X = 4" or "typedef int foo".
      34               80:     virtual DeclPtrTy ActOnDeclarator(Scope *S, Declarator &D) {
      35               80:       Out << __FUNCTION__ << " ";
                       80: branch 1 taken
                        0: branch 2 not taken
      36               80:       if (IdentifierInfo *II = D.getIdentifier()) {
      37               80:         Out << "'" << II->getName() << "'";
      38                 :       } else {
      39                0:         Out << "<anon>";
      40                 :       }
      41               80:       Out << "\n";
      42                 : 
      43                 :       // Pass up to EmptyActions so that the symbol table is maintained right.
      44               80:       return MinimalAction::ActOnDeclarator(S, D);
      45                 :     }
      46                 :     /// ActOnPopScope - This callback is called immediately before the specified
      47                 :     /// scope is popped and deleted.
      48                2:     virtual void ActOnPopScope(SourceLocation Loc, Scope *S) {
      49                2:       Out << __FUNCTION__ << "\n";
      50                2:       return MinimalAction::ActOnPopScope(Loc, S);
      51                 :     }
      52                 : 
      53                 :     /// ActOnTranslationUnitScope - This callback is called once, immediately
      54                 :     /// after creating the translation unit scope (in Parser::Initialize).
      55                2:     virtual void ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) {
      56                2:       Out << __FUNCTION__ << "\n";
      57                2:       MinimalAction::ActOnTranslationUnitScope(Loc, S);
      58                2:     }
      59                 : 
      60                 : 
      61                 :     Action::DeclPtrTy ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
      62                 :                                                IdentifierInfo *ClassName,
      63                 :                                                SourceLocation ClassLoc,
      64                 :                                                IdentifierInfo *SuperName,
      65                 :                                                SourceLocation SuperLoc,
      66                 :                                                const DeclPtrTy *ProtoRefs,
      67                 :                                                unsigned NumProtocols,
      68                 :                                                const SourceLocation *ProtoLocs,
      69                 :                                                SourceLocation EndProtoLoc,
      70                3:                                                AttributeList *AttrList) {
      71                3:       Out << __FUNCTION__ << "\n";
      72                 :       return MinimalAction::ActOnStartClassInterface(AtInterfaceLoc,
      73                 :                                                      ClassName, ClassLoc,
      74                 :                                                      SuperName, SuperLoc,
      75                 :                                                      ProtoRefs, NumProtocols,
      76                 :                                                      ProtoLocs, EndProtoLoc,
      77                3:                                                      AttrList);
      78                 :     }
      79                 : 
      80                 :     /// ActOnForwardClassDeclaration -
      81                 :     /// Scope will always be top level file scope.
      82                 :     Action::DeclPtrTy ActOnForwardClassDeclaration(SourceLocation AtClassLoc,
      83                 :                                                    IdentifierInfo **IdentList,
      84                 :                                                    SourceLocation *IdentLocs,
      85                1:                                                    unsigned NumElts) {
      86                1:       Out << __FUNCTION__ << "\n";
      87                 :       return MinimalAction::ActOnForwardClassDeclaration(AtClassLoc, IdentList,
      88                1:                                                          IdentLocs, NumElts);
      89                 :     }
      90                 : 
      91                 :     // Pure Printing
      92                 : 
      93                 :     /// ActOnParamDeclarator - This callback is invoked when a parameter
      94                 :     /// declarator is parsed. This callback only occurs for functions
      95                 :     /// with prototypes. S is the function prototype scope for the
      96                 :     /// parameters (C++ [basic.scope.proto]).
      97               18:     virtual DeclPtrTy ActOnParamDeclarator(Scope *S, Declarator &D) {
      98               18:       Out << __FUNCTION__ << " ";
                       12: branch 1 taken
                        6: branch 2 taken
      99               18:       if (IdentifierInfo *II = D.getIdentifier()) {
     100               12:         Out << "'" << II->getName() << "'";
     101                 :       } else {
     102                6:         Out << "<anon>";
     103                 :       }
     104               18:       Out << "\n";
     105               18:       return DeclPtrTy();
     106                 :     }
     107                 : 
     108                 :     /// AddInitializerToDecl - This action is called immediately after
     109                 :     /// ParseDeclarator (when an initializer is present). The code is factored
     110                 :     /// this way to make sure we are able to handle the following:
     111                 :     ///   void func() { int xx = xx; }
     112                 :     /// This allows ActOnDeclarator to register "xx" prior to parsing the
     113                 :     /// initializer. The declaration above should still result in a warning,
     114                 :     /// since the reference to "xx" is uninitialized.
     115               41:     virtual void AddInitializerToDecl(DeclPtrTy Dcl, ExprArg Init) {
     116               41:       Out << __FUNCTION__ << "\n";
     117               41:     }
     118                 : 
     119                 :     /// FinalizeDeclaratorGroup - After a sequence of declarators are parsed,
     120                 :     /// this gives the actions implementation a chance to process the group as
     121                 :     /// a whole.
     122                 :     virtual DeclGroupPtrTy FinalizeDeclaratorGroup(Scope *S, const DeclSpec& DS,
     123                 :                                                    DeclPtrTy *Group,
     124               71:                                                    unsigned NumDecls) {
     125               71:       Out << __FUNCTION__ << "\n";
     126               71:       return DeclGroupPtrTy();
     127                 :     }
     128                 : 
     129                 :     /// ActOnStartOfFunctionDef - This is called at the start of a function
     130                 :     /// definition, instead of calling ActOnDeclarator.  The Declarator includes
     131                 :     /// information about formal arguments that are part of this function.
     132                 :     virtual DeclPtrTy ActOnStartOfFunctionDef(Scope *FnBodyScope,
     133               12:                                               Declarator &D){
     134               12:       Out << __FUNCTION__ << "\n";
     135               12:       return DeclPtrTy();
     136                 :     }
     137                 : 
     138                 :     /// ActOnStartOfFunctionDef - This is called at the start of a function
     139                 :     /// definition, after the FunctionDecl has already been created.
     140                0:     virtual DeclPtrTy ActOnStartOfFunctionDef(Scope *FnBodyScope, DeclPtrTy D) {
     141                0:       Out << __FUNCTION__ << "\n";
     142                0:       return DeclPtrTy();
     143                 :     }
     144                 : 
     145                3:     virtual void ActOnStartOfObjCMethodDef(Scope *FnBodyScope, DeclPtrTy D) {
     146                3:       Out << __FUNCTION__ << "\n";
     147                3:     }
     148                 : 
     149                 :     /// ActOnFunctionDefBody - This is called when a function body has completed
     150                 :     /// parsing.  Decl is the DeclTy returned by ParseStartOfFunctionDef.
     151               15:     virtual DeclPtrTy ActOnFinishFunctionBody(DeclPtrTy Decl, StmtArg Body) {
     152               15:       Out << __FUNCTION__ << "\n";
     153               15:       return DeclPtrTy();
     154                 :     }
     155                 : 
     156                 :     virtual DeclPtrTy ActOnFileScopeAsmDecl(SourceLocation Loc,
     157                1:                                             ExprArg AsmString) {
     158                1:       Out << __FUNCTION__ << "\n";
     159                1:       return DeclPtrTy();
     160                 :     }
     161                 : 
     162                 :     /// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with
     163                 :     /// no declarator (e.g. "struct foo;") is parsed.
     164                5:     virtual DeclPtrTy ParsedFreeStandingDeclSpec(Scope *S, DeclSpec &DS) {
     165                5:       Out << __FUNCTION__ << "\n";
     166                5:       return DeclPtrTy();
     167                 :     }
     168                 : 
     169                 :     /// ActOnLinkageSpec - Parsed a C++ linkage-specification that
     170                 :     /// contained braces. Lang/StrSize contains the language string that
     171                 :     /// was parsed at location Loc. Decls/NumDecls provides the
     172                 :     /// declarations parsed inside the linkage specification.
     173                 :     virtual DeclPtrTy ActOnLinkageSpec(SourceLocation Loc,
     174                 :                                        SourceLocation LBrace,
     175                 :                                        SourceLocation RBrace, const char *Lang,
     176                 :                                        unsigned StrSize,
     177                0:                                        DeclPtrTy *Decls, unsigned NumDecls) {
     178                0:       Out << __FUNCTION__ << "\n";
     179                0:       return DeclPtrTy();
     180                 :     }
     181                 : 
     182                 :     /// ActOnLinkageSpec - Parsed a C++ linkage-specification without
     183                 :     /// braces. Lang/StrSize contains the language string that was
     184                 :     /// parsed at location Loc. D is the declaration parsed.
     185                 :     virtual DeclPtrTy ActOnLinkageSpec(SourceLocation Loc, const char *Lang,
     186                0:                                        unsigned StrSize, DeclPtrTy D) {
     187                0:       return DeclPtrTy();
     188                 :     }
     189                 : 
     190                 :     //===------------------------------------------------------------------===//
     191                 :     // Type Parsing Callbacks.
     192                 :     //===------------------------------------------------------------------===//
     193                 : 
     194               16:     virtual TypeResult ActOnTypeName(Scope *S, Declarator &D) {
     195               16:       Out << __FUNCTION__ << "\n";
     196               16:       return TypeResult();
     197                 :     }
     198                 : 
     199                 :     virtual DeclPtrTy ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
     200                 :                                SourceLocation KWLoc, const CXXScopeSpec &SS,
     201                 :                                IdentifierInfo *Name, SourceLocation NameLoc,
     202                 :                                AttributeList *Attr, AccessSpecifier AS,
     203                 :                                MultiTemplateParamsArg TemplateParameterLists,
     204               11:                                bool &OwnedDecl, bool &IsDependent) {
     205                 :       // TagType is an instance of DeclSpec::TST, indicating what kind of tag this
     206                 :       // is (struct/union/enum/class).
     207               11:       Out << __FUNCTION__ << "\n";
     208               11:       return DeclPtrTy();
     209                 :     }
     210                 : 
     211                 :     /// Act on @defs() element found when parsing a structure.  ClassName is the
     212                 :     /// name of the referenced class.
     213                 :     virtual void ActOnDefs(Scope *S, DeclPtrTy TagD, SourceLocation DeclStart,
     214                 :                            IdentifierInfo *ClassName,
     215                1:                            llvm::SmallVectorImpl<DeclPtrTy> &Decls) {
     216                1:       Out << __FUNCTION__ << "\n";
     217                1:     }
     218                 : 
     219                 :     virtual DeclPtrTy ActOnField(Scope *S, DeclPtrTy TagD,
     220                 :                                  SourceLocation DeclStart,
     221                8:                                  Declarator &D, ExprTy *BitfieldWidth) {
     222                8:       Out << __FUNCTION__ << "\n";
     223                8:       return DeclPtrTy();
     224                 :     }
     225                 : 
     226                 :     virtual DeclPtrTy ActOnIvar(Scope *S, SourceLocation DeclStart,
     227                 :                                 DeclPtrTy IntfDecl,
     228                 :                                 Declarator &D, ExprTy *BitfieldWidth,
     229                3:                                 tok::ObjCKeywordKind visibility) {
     230                3:       Out << __FUNCTION__ << "\n";
     231                3:       return DeclPtrTy();
     232                 :     }
     233                 : 
     234                 :     virtual void ActOnFields(Scope* S, SourceLocation RecLoc, DeclPtrTy TagDecl,
     235                 :                              DeclPtrTy *Fields, unsigned NumFields,
     236                 :                              SourceLocation LBrac, SourceLocation RBrac,
     237                8:                              AttributeList *AttrList) {
     238                8:       Out << __FUNCTION__ << "\n";
     239                8:     }
     240                 : 
     241                 :     virtual DeclPtrTy ActOnEnumConstant(Scope *S, DeclPtrTy EnumDecl,
     242                 :                                         DeclPtrTy LastEnumConstant,
     243                 :                                         SourceLocation IdLoc,IdentifierInfo *Id,
     244                1:                                         SourceLocation EqualLoc, ExprTy *Val) {
     245                1:       Out << __FUNCTION__ << "\n";
     246                1:       return DeclPtrTy();
     247                 :     }
     248                 : 
     249                 :     virtual void ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc,
     250                 :                                SourceLocation RBraceLoc, DeclPtrTy EnumDecl,
     251                 :                                DeclPtrTy *Elements, unsigned NumElements,
     252                1:                                Scope *S, AttributeList *AttrList) {
     253                1:       Out << __FUNCTION__ << "\n";
     254                1:     }
     255                 : 
     256                 :     //===------------------------------------------------------------------===//
     257                 :     // Statement Parsing Callbacks.
     258                 :     //===------------------------------------------------------------------===//
     259                 : 
     260                3:     virtual OwningStmtResult ActOnNullStmt(SourceLocation SemiLoc) {
     261                3:       Out << __FUNCTION__ << "\n";
     262                3:       return StmtEmpty();
     263                 :     }
     264                 : 
     265                 :     virtual OwningStmtResult ActOnCompoundStmt(SourceLocation L,
     266                 :                                                SourceLocation R,
     267                 :                                                MultiStmtArg Elts,
     268               28:                                                bool isStmtExpr) {
     269               28:       Out << __FUNCTION__ << "\n";
     270               28:       return StmtEmpty();
     271                 :     }
     272                 :     virtual OwningStmtResult ActOnDeclStmt(DeclGroupPtrTy Decl,
     273                 :                                            SourceLocation StartLoc,
     274               59:                                            SourceLocation EndLoc) {
     275               59:       Out << __FUNCTION__ << "\n";
     276               59:       return StmtEmpty();
     277                 :     }
     278                 : 
     279               17:     virtual OwningStmtResult ActOnExprStmt(FullExprArg Expr) {
     280               17:       Out << __FUNCTION__ << "\n";
     281               17:       return OwningStmtResult(*this, Expr->release());
     282                 :     }
     283                 : 
     284                 :     /// ActOnCaseStmt - Note that this handles the GNU 'case 1 ... 4' extension,
     285                 :     /// which can specify an RHS value.
     286                 :     virtual OwningStmtResult ActOnCaseStmt(SourceLocation CaseLoc,
     287                 :                                            ExprArg LHSVal,
     288                 :                                            SourceLocation DotDotDotLoc,
     289                 :                                            ExprArg RHSVal,
     290                2:                                            SourceLocation ColonLoc) {
     291                2:       Out << __FUNCTION__ << "\n";
     292                2:       return StmtEmpty();
     293                 :     }
     294                 :     virtual OwningStmtResult ActOnDefaultStmt(SourceLocation DefaultLoc,
     295                 :                                               SourceLocation ColonLoc,
     296                1:                                               StmtArg SubStmt, Scope *CurScope){
     297                1:       Out << __FUNCTION__ << "\n";
     298                1:       return StmtEmpty();
     299                 :     }
     300                 : 
     301                 :     virtual OwningStmtResult ActOnLabelStmt(SourceLocation IdentLoc,
     302                 :                                             IdentifierInfo *II,
     303                 :                                             SourceLocation ColonLoc,
     304                1:                                             StmtArg SubStmt) {
     305                1:       Out << __FUNCTION__ << "\n";
     306                1:       return StmtEmpty();
     307                 :     }
     308                 : 
     309                 :     virtual OwningStmtResult ActOnIfStmt(SourceLocation IfLoc,
     310                 :                                          FullExprArg CondVal, DeclPtrTy CondVar,
     311                 :                                          StmtArg ThenVal,
     312                 :                                          SourceLocation ElseLoc,
     313                2:                                          StmtArg ElseVal) {
     314                2:       Out << __FUNCTION__ << "\n";
     315                2:       return StmtEmpty();
     316                 :     }
     317                 : 
     318                 :     virtual OwningStmtResult ActOnStartOfSwitchStmt(FullExprArg Cond, 
     319                1:                                                     DeclPtrTy CondVar) {
     320                1:       Out << __FUNCTION__ << "\n";
     321                1:       return StmtEmpty();
     322                 :     }
     323                 : 
     324                 :     virtual OwningStmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc,
     325                 :                                                    StmtArg Switch,
     326                1:                                                    StmtArg Body) {
     327                1:       Out << __FUNCTION__ << "\n";
     328                1:       return StmtEmpty();
     329                 :     }
     330                 : 
     331                 :     virtual OwningStmtResult ActOnWhileStmt(SourceLocation WhileLoc,
     332                 :                                             FullExprArg Cond, DeclPtrTy CondVar,
     333                1:                                             StmtArg Body) {
     334                1:       Out << __FUNCTION__ << "\n";
     335                1:       return StmtEmpty();
     336                 :     }
     337                 :     virtual OwningStmtResult ActOnDoStmt(SourceLocation DoLoc, StmtArg Body,
     338                 :                                          SourceLocation WhileLoc,
     339                 :                                          SourceLocation LPLoc, ExprArg Cond,
     340                1:                                          SourceLocation RPLoc){
     341                1:       Out << __FUNCTION__ << "\n";
     342                1:       return StmtEmpty();
     343                 :     }
     344                 :     virtual OwningStmtResult ActOnForStmt(SourceLocation ForLoc,
     345                 :                                         SourceLocation LParenLoc,
     346                 :                                         StmtArg First, FullExprArg Second,
     347                 :                                         DeclPtrTy SecondVar,
     348                 :                                         FullExprArg Third, 
     349                 :                                         SourceLocation RParenLoc,
     350                1:                                         StmtArg Body) {
     351                1:       Out << __FUNCTION__ << "\n";
     352                1:       return StmtEmpty();
     353                 :     }
     354                 :     virtual OwningStmtResult ActOnObjCForCollectionStmt(
     355                 :                                        SourceLocation ForColLoc,
     356                 :                                        SourceLocation LParenLoc,
     357                 :                                        StmtArg First, ExprArg Second,
     358                1:                                        SourceLocation RParenLoc, StmtArg Body) {
     359                1:       Out << __FUNCTION__ << "\n";
     360                1:       return StmtEmpty();
     361                 :     }
     362                 :     virtual OwningStmtResult ActOnGotoStmt(SourceLocation GotoLoc,
     363                 :                                            SourceLocation LabelLoc,
     364                1:                                            IdentifierInfo *LabelII) {
     365                1:       Out << __FUNCTION__ << "\n";
     366                1:       return StmtEmpty();
     367                 :     }
     368                 :     virtual OwningStmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc,
     369                 :                                                    SourceLocation StarLoc,
     370                1:                                                    ExprArg DestExp) {
     371                1:       Out << __FUNCTION__ << "\n";
     372                1:       return StmtEmpty();
     373                 :     }
     374                 :     virtual OwningStmtResult ActOnContinueStmt(SourceLocation ContinueLoc,
     375                1:                                                Scope *CurScope) {
     376                1:       Out << __FUNCTION__ << "\n";
     377                1:       return StmtEmpty();
     378                 :     }
     379                 :     virtual OwningStmtResult ActOnBreakStmt(SourceLocation GotoLoc,
     380                4:                                             Scope *CurScope) {
     381                4:       Out << __FUNCTION__ << "\n";
     382                4:       return StmtEmpty();
     383                 :     }
     384                 :     virtual OwningStmtResult ActOnReturnStmt(SourceLocation ReturnLoc,
     385                1:                                              ExprArg RetValExp) {
     386                1:       Out << __FUNCTION__ << "\n";
     387                1:       return StmtEmpty();
     388                 :     }
     389                 :     virtual OwningStmtResult ActOnAsmStmt(SourceLocation AsmLoc,
     390                 :                                           bool IsSimple,
     391                 :                                           bool IsVolatile,
     392                 :                                           unsigned NumOutputs,
     393                 :                                           unsigned NumInputs,
     394                 :                                           IdentifierInfo **Names,
     395                 :                                           MultiExprArg Constraints,
     396                 :                                           MultiExprArg Exprs,
     397                 :                                           ExprArg AsmString,
     398                 :                                           MultiExprArg Clobbers,
     399                 :                                           SourceLocation RParenLoc,
     400                1:                                           bool MSAsm) {
     401                1:       Out << __FUNCTION__ << "\n";
     402                1:       return StmtEmpty();
     403                 :     }
     404                 : 
     405                 :     // Objective-c statements
     406                 :     virtual OwningStmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc,
     407                 :                                                   SourceLocation RParen,
     408                 :                                                   DeclPtrTy Parm, StmtArg Body,
     409                2:                                                   StmtArg CatchList) {
     410                2:       Out << __FUNCTION__ << "\n";
     411                2:       return StmtEmpty();
     412                 :     }
     413                 : 
     414                 :     virtual OwningStmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc,
     415                1:                                                     StmtArg Body) {
     416                1:       Out << __FUNCTION__ << "\n";
     417                1:       return StmtEmpty();
     418                 :     }
     419                 : 
     420                 :     virtual OwningStmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc,
     421                 :                                                 StmtArg Try, StmtArg Catch,
     422                1:                                                 StmtArg Finally) {
     423                1:       Out << __FUNCTION__ << "\n";
     424                1:       return StmtEmpty();
     425                 :     }
     426                 : 
     427                 :     virtual OwningStmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc,
     428                 :                                                   ExprArg Throw,
     429                2:                                                   Scope *CurScope) {
     430                2:       Out << __FUNCTION__ << "\n";
     431                2:       return StmtEmpty();
     432                 :     }
     433                 : 
     434                 :     virtual OwningStmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc,
     435                 :                                                          ExprArg SynchExpr,
     436                1:                                                          StmtArg SynchBody) {
     437                1:       Out << __FUNCTION__ << "\n";
     438                1:       return StmtEmpty();
     439                 :     }
     440                 : 
     441                 :     // C++ Statements
     442                0:     virtual DeclPtrTy ActOnExceptionDeclarator(Scope *S, Declarator &D) {
     443                0:       Out << __FUNCTION__ << "\n";
     444                0:       return DeclPtrTy();
     445                 :     }
     446                 : 
     447                 :     virtual OwningStmtResult ActOnCXXCatchBlock(SourceLocation CatchLoc,
     448                 :                                                 DeclPtrTy ExceptionDecl,
     449                0:                                                 StmtArg HandlerBlock) {
     450                0:       Out << __FUNCTION__ << "\n";
     451                0:       return StmtEmpty();
     452                 :     }
     453                 : 
     454                 :     virtual OwningStmtResult ActOnCXXTryBlock(SourceLocation TryLoc,
     455                 :                                               StmtArg TryBlock,
     456                0:                                               MultiStmtArg Handlers) {
     457                0:       Out << __FUNCTION__ << "\n";
     458                0:       return StmtEmpty();
     459                 :     }
     460                 : 
     461                 :     //===------------------------------------------------------------------===//
     462                 :     // Expression Parsing Callbacks.
     463                 :     //===------------------------------------------------------------------===//
     464                 : 
     465                 :     // Primary Expressions.
     466                 : 
     467                 :     /// ActOnIdentifierExpr - Parse an identifier in expression context.
     468                 :     /// 'HasTrailingLParen' indicates whether or not the identifier has a '('
     469                 :     /// token immediately after it.
     470                 :     virtual OwningExprResult ActOnIdentifierExpr(Scope *S, SourceLocation Loc,
     471                 :                                                  IdentifierInfo &II,
     472                 :                                                  bool HasTrailingLParen,
     473                 :                                                  const CXXScopeSpec *SS,
     474                0:                                                  bool isAddressOfOperand) {
     475                0:       Out << __FUNCTION__ << "\n";
     476                0:       return ExprEmpty();
     477                 :     }
     478                 : 
     479                 :     virtual OwningExprResult ActOnCXXOperatorFunctionIdExpr(
     480                 :                                Scope *S, SourceLocation OperatorLoc,
     481                 :                                OverloadedOperatorKind Op,
     482                 :                                bool HasTrailingLParen, const CXXScopeSpec &SS,
     483                0:                                bool isAddressOfOperand) {
     484                0:       Out << __FUNCTION__ << "\n";
     485                0:       return ExprEmpty();
     486                 :     }
     487                 : 
     488                 :     virtual OwningExprResult ActOnCXXConversionFunctionExpr(
     489                 :                                Scope *S, SourceLocation OperatorLoc,
     490                 :                                TypeTy *Type, bool HasTrailingLParen,
     491                0:                                const CXXScopeSpec &SS,bool isAddressOfOperand) {
     492                0:       Out << __FUNCTION__ << "\n";
     493                0:       return ExprEmpty();
     494                 :     }
     495                 : 
     496                 :     virtual OwningExprResult ActOnPredefinedExpr(SourceLocation Loc,
     497                7:                                                  tok::TokenKind Kind) {
     498                7:       Out << __FUNCTION__ << "\n";
     499                7:       return ExprEmpty();
     500                 :     }
     501                 : 
     502                1:     virtual OwningExprResult ActOnCharacterConstant(const Token &) {
     503                1:       Out << __FUNCTION__ << "\n";
     504                1:       return ExprEmpty();
     505                 :     }
     506                 : 
     507               30:     virtual OwningExprResult ActOnNumericConstant(const Token &) {
     508               30:       Out << __FUNCTION__ << "\n";
     509               30:       return ExprEmpty();
     510                 :     }
     511                 : 
     512                 :     /// ActOnStringLiteral - The specified tokens were lexed as pasted string
     513                 :     /// fragments (e.g. "foo" "bar" L"baz").
     514                 :     virtual OwningExprResult ActOnStringLiteral(const Token *Toks,
     515                3:                                                 unsigned NumToks) {
     516                3:       Out << __FUNCTION__ << "\n";
     517                3:       return ExprEmpty();
     518                 :     }
     519                 : 
     520                 :     virtual OwningExprResult ActOnParenExpr(SourceLocation L, SourceLocation R,
     521                3:                                             ExprArg Val) {
     522                3:       Out << __FUNCTION__ << "\n";
     523                3:       return move(Val);  // Default impl returns operand.
     524                 :     }
     525                 : 
     526                 :     // Postfix Expressions.
     527                 :     virtual OwningExprResult ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc,
     528                 :                                                  tok::TokenKind Kind,
     529                1:                                                  ExprArg Input) {
     530                1:       Out << __FUNCTION__ << "\n";
     531                1:       return ExprEmpty();
     532                 :     }
     533                 :     virtual OwningExprResult ActOnArraySubscriptExpr(Scope *S, ExprArg Base,
     534                 :                                                      SourceLocation LLoc,
     535                 :                                                      ExprArg Idx,
     536                2:                                                      SourceLocation RLoc) {
     537                2:       Out << __FUNCTION__ << "\n";
     538                2:       return ExprEmpty();
     539                 :     }
     540                 :     virtual OwningExprResult ActOnMemberReferenceExpr(Scope *S, ExprArg Base,
     541                 :                                                       SourceLocation OpLoc,
     542                 :                                                       tok::TokenKind OpKind,
     543                 :                                                       SourceLocation MemberLoc,
     544                 :                                                       IdentifierInfo &Member,
     545                 :                                                       DeclPtrTy ImplDecl,
     546                0:                                                       const CXXScopeSpec *SS=0) {
     547                0:       Out << __FUNCTION__ << "\n";
     548                0:       return ExprEmpty();
     549                 :     }
     550                 : 
     551                 :     virtual OwningExprResult ActOnCallExpr(Scope *S, ExprArg Fn,
     552                 :                                            SourceLocation LParenLoc,
     553                 :                                            MultiExprArg Args,
     554                 :                                            SourceLocation *CommaLocs,
     555                5:                                            SourceLocation RParenLoc) {
     556                5:       Out << __FUNCTION__ << "\n";
     557                5:       return ExprEmpty();
     558                 :     }
     559                 : 
     560                 :     // Unary Operators.  'Tok' is the token for the operator.
     561                 :     virtual OwningExprResult ActOnUnaryOp(Scope *S, SourceLocation OpLoc,
     562               15:                                           tok::TokenKind Op, ExprArg Input) {
     563               15:       Out << __FUNCTION__ << "\n";
     564               15:       return ExprEmpty();
     565                 :     }
     566                 :     virtual OwningExprResult
     567                 :       ActOnSizeOfAlignOfExpr(SourceLocation OpLoc, bool isSizeof, bool isType,
     568                1:                              void *TyOrEx, const SourceRange &ArgRange) {
     569                1:       Out << __FUNCTION__ << "\n";
     570                1:       return ExprEmpty();
     571                 :     }
     572                 : 
     573                 :     virtual OwningExprResult ActOnCompoundLiteral(SourceLocation LParen,
     574                 :                                                   TypeTy *Ty,
     575                 :                                                   SourceLocation RParen,
     576                0:                                                   ExprArg Op) {
     577                0:       Out << __FUNCTION__ << "\n";
     578                0:       return ExprEmpty();
     579                 :     }
     580                 :     virtual OwningExprResult ActOnInitList(SourceLocation LParenLoc,
     581                 :                                            MultiExprArg InitList,
     582                5:                                            SourceLocation RParenLoc) {
     583                5:       Out << __FUNCTION__ << "\n";
     584                5:       return ExprEmpty();
     585                 :     }
     586                 :     virtual OwningExprResult ActOnCastExpr(Scope *S, SourceLocation LParenLoc,
     587                 :                                            TypeTy *Ty, SourceLocation RParenLoc,
     588                3:                                            ExprArg Op) {
     589                3:       Out << __FUNCTION__ << "\n";
     590                3:       return ExprEmpty();
     591                 :     }
     592                 : 
     593                 :     virtual OwningExprResult ActOnBinOp(Scope *S, SourceLocation TokLoc,
     594                 :                                         tok::TokenKind Kind,
     595                9:                                         ExprArg LHS, ExprArg RHS) {
     596                9:       Out << __FUNCTION__ << "\n";
     597                9:       return ExprEmpty();
     598                 :     }
     599                 : 
     600                 :     /// ActOnConditionalOp - Parse a ?: operation.  Note that 'LHS' may be null
     601                 :     /// in the case of a the GNU conditional expr extension.
     602                 :     virtual OwningExprResult ActOnConditionalOp(SourceLocation QuestionLoc,
     603                 :                                                 SourceLocation ColonLoc,
     604                 :                                                 ExprArg Cond, ExprArg LHS,
     605                4:                                                 ExprArg RHS) {
     606                4:       Out << __FUNCTION__ << "\n";
     607                4:       return ExprEmpty();
     608                 :     }
     609                 : 
     610                 :     //===--------------------- GNU Extension Expressions ------------------===//
     611                 : 
     612                 :     virtual OwningExprResult ActOnAddrLabel(SourceLocation OpLoc,
     613                 :                                             SourceLocation LabLoc,
     614                1:                                             IdentifierInfo *LabelII) {// "&&foo"
     615                1:       Out << __FUNCTION__ << "\n";
     616                1:       return ExprEmpty();
     617                 :     }
     618                 : 
     619                 :     virtual OwningExprResult ActOnStmtExpr(SourceLocation LPLoc,
     620                 :                                            StmtArg SubStmt,
     621                0:                                            SourceLocation RPLoc) { // "({..})"
     622                0:       Out << __FUNCTION__ << "\n";
     623                0:       return ExprEmpty();
     624                 :     }
     625                 : 
     626                 :     virtual OwningExprResult ActOnBuiltinOffsetOf(Scope *S,
     627                 :                                                   SourceLocation BuiltinLoc,
     628                 :                                                   SourceLocation TypeLoc,
     629                 :                                                   TypeTy *Arg1,
     630                 :                                                   OffsetOfComponent *CompPtr,
     631                 :                                                   unsigned NumComponents,
     632                1:                                                   SourceLocation RParenLoc) {
     633                1:       Out << __FUNCTION__ << "\n";
     634                1:       return ExprEmpty();
     635                 :     }
     636                 : 
     637                 :     // __builtin_types_compatible_p(type1, type2)
     638                 :     virtual OwningExprResult ActOnTypesCompatibleExpr(SourceLocation BuiltinLoc,
     639                 :                                                       TypeTy *arg1,TypeTy *arg2,
     640                1:                                                       SourceLocation RPLoc) {
     641                1:       Out << __FUNCTION__ << "\n";
     642                1:       return ExprEmpty();
     643                 :     }
     644                 :     // __builtin_choose_expr(constExpr, expr1, expr2)
     645                 :     virtual OwningExprResult ActOnChooseExpr(SourceLocation BuiltinLoc,
     646                 :                                              ExprArg cond, ExprArg expr1,
     647                 :                                              ExprArg expr2,
     648                0:                                              SourceLocation RPLoc) {
     649                0:       Out << __FUNCTION__ << "\n";
     650                0:       return ExprEmpty();
     651                 :     }
     652                 : 
     653                 :     // __builtin_va_arg(expr, type)
     654                 :     virtual OwningExprResult ActOnVAArg(SourceLocation BuiltinLoc,
     655                 :                                   ExprArg expr, TypeTy *type,
     656                1:                                   SourceLocation RPLoc) {
     657                1:       Out << __FUNCTION__ << "\n";
     658                1:       return ExprEmpty();
     659                 :     }
     660                 : 
     661                0:     virtual OwningExprResult ActOnGNUNullExpr(SourceLocation TokenLoc) {
     662                0:       Out << __FUNCTION__ << "\n";
     663                0:       return ExprEmpty();
     664                 :     }
     665                 : 
     666                0:     virtual void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope) {
     667                0:       Out << __FUNCTION__ << "\n";
     668                0:     }
     669                 : 
     670                0:     virtual void ActOnBlockArguments(Declarator &ParamInfo, Scope *CurScope) {
     671                0:       Out << __FUNCTION__ << "\n";
     672                0:     }
     673                 : 
     674                0:     virtual void ActOnBlockError(SourceLocation CaretLoc, Scope *CurScope) {
     675                0:       Out << __FUNCTION__ << "\n";
     676                0:     }
     677                 : 
     678                 :     virtual OwningExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc,
     679                 :                                                 StmtArg Body,
     680                0:                                                 Scope *CurScope) {
     681                0:       Out << __FUNCTION__ << "\n";
     682                0:       return ExprEmpty();
     683                 :     }
     684                 : 
     685                 :     virtual DeclPtrTy ActOnStartNamespaceDef(Scope *S, SourceLocation IdentLoc,
     686                 :                                              IdentifierInfo *Ident,
     687                 :                                              SourceLocation LBrace,
     688                0:                                              AttributeList *AttrList) {
     689                0:       Out << __FUNCTION__ << "\n";
     690                0:       return DeclPtrTy();
     691                 :     }
     692                 : 
     693                0:     virtual void ActOnFinishNamespaceDef(DeclPtrTy Dcl, SourceLocation RBrace) {
     694                0:       Out << __FUNCTION__ << "\n";
     695                 :       return;
     696                 :     }
     697                 : 
     698                 : #if 0
     699                 :     // FIXME: AttrList should be deleted by this function, but the definition
     700                 :     // would have to be available.
     701                 :     virtual DeclPtrTy ActOnUsingDirective(Scope *CurScope,
     702                 :                                           SourceLocation UsingLoc,
     703                 :                                           SourceLocation NamespcLoc,
     704                 :                                           const CXXScopeSpec &SS,
     705                 :                                           SourceLocation IdentLoc,
     706                 :                                           IdentifierInfo *NamespcName,
     707                 :                                           AttributeList *AttrList) {
     708                 :       Out << __FUNCTION__ << "\n";
     709                 :       return DeclPtrTy();
     710                 :     }
     711                 : #endif
     712                 : 
     713                 :     virtual void ActOnParamDefaultArgument(DeclPtrTy param,
     714                 :                                            SourceLocation EqualLoc,
     715                0:                                            ExprArg defarg) {
     716                0:       Out << __FUNCTION__ << "\n";
     717                0:     }
     718                 : 
     719                 :     virtual void ActOnParamUnparsedDefaultArgument(DeclPtrTy param,
     720                 :                                                    SourceLocation EqualLoc,
     721                0:                                                    SourceLocation ArgLoc) {
     722                0:       Out << __FUNCTION__ << "\n";
     723                0:     }
     724                 : 
     725                0:     virtual void ActOnParamDefaultArgumentError(DeclPtrTy param) {
     726                0:       Out << __FUNCTION__ << "\n";
     727                0:     }
     728                 : 
     729                 :     virtual void AddCXXDirectInitializerToDecl(DeclPtrTy Dcl,
     730                 :                                                SourceLocation LParenLoc,
     731                 :                                                MultiExprArg Exprs,
     732                 :                                                SourceLocation *CommaLocs,
     733                0:                                                SourceLocation RParenLoc) {
     734                0:       Out << __FUNCTION__ << "\n";
     735                 :       return;
     736                 :     }
     737                 : 
     738                 :     virtual void ActOnStartDelayedCXXMethodDeclaration(Scope *S,
     739                0:                                                        DeclPtrTy Method) {
     740                0:       Out << __FUNCTION__ << "\n";
     741                0:     }
     742                 : 
     743                0:     virtual void ActOnDelayedCXXMethodParameter(Scope *S, DeclPtrTy Param) {
     744                0:       Out << __FUNCTION__ << "\n";
     745                0:     }
     746                 : 
     747                 :     virtual void ActOnFinishDelayedCXXMethodDeclaration(Scope *S,
     748                0:                                                         DeclPtrTy Method) {
     749                0:       Out << __FUNCTION__ << "\n";
     750                0:     }
     751                 : 
     752                 :     virtual DeclPtrTy ActOnStaticAssertDeclaration(SourceLocation AssertLoc,
     753                 :                                                    ExprArg AssertExpr,
     754                0:                                                    ExprArg AssertMessageExpr) {
     755                0:       Out << __FUNCTION__ << "\n";
     756                0:       return DeclPtrTy();
     757                 :     }
     758                 : 
     759                 :     virtual OwningExprResult ActOnCXXNamedCast(SourceLocation OpLoc,
     760                 :                                                tok::TokenKind Kind,
     761                 :                                                SourceLocation LAngleBracketLoc,
     762                 :                                                TypeTy *Ty,
     763                 :                                                SourceLocation RAngleBracketLoc,
     764                 :                                                SourceLocation LParenLoc,
     765                 :                                                ExprArg Op,
     766                0:                                                SourceLocation RParenLoc) {
     767                0:       Out << __FUNCTION__ << "\n";
     768                0:       return ExprEmpty();
     769                 :     }
     770                 : 
     771                 :     virtual OwningExprResult ActOnCXXTypeid(SourceLocation OpLoc,
     772                 :                                             SourceLocation LParenLoc,
     773                 :                                             bool isType, void *TyOrExpr,
     774                0:                                             SourceLocation RParenLoc) {
     775                0:       Out << __FUNCTION__ << "\n";
     776                0:       return ExprEmpty();
     777                 :     }
     778                 : 
     779                0:     virtual OwningExprResult ActOnCXXThis(SourceLocation ThisLoc) {
     780                0:       Out << __FUNCTION__ << "\n";
     781                0:       return ExprEmpty();
     782                 :     }
     783                 : 
     784                 :     virtual OwningExprResult ActOnCXXBoolLiteral(SourceLocation OpLoc,
     785                0:                                                  tok::TokenKind Kind) {
     786                0:       Out << __FUNCTION__ << "\n";
     787                0:       return ExprEmpty();
     788                 :     }
     789                 : 
     790                0:     virtual OwningExprResult ActOnCXXThrow(SourceLocation OpLoc, ExprArg Op) {
     791                0:       Out << __FUNCTION__ << "\n";
     792                0:       return ExprEmpty();
     793                 :     }
     794                 : 
     795                 :     virtual OwningExprResult ActOnCXXTypeConstructExpr(SourceRange TypeRange,
     796                 :                                                      TypeTy *TypeRep,
     797                 :                                                      SourceLocation LParenLoc,
     798                 :                                                      MultiExprArg Exprs,
     799                 :                                                      SourceLocation *CommaLocs,
     800                0:                                                      SourceLocation RParenLoc) {
     801                0:       Out << __FUNCTION__ << "\n";
     802                0:       return ExprEmpty();
     803                 :     }
     804                 : 
     805                 :     virtual OwningExprResult ActOnCXXConditionDeclarationExpr(Scope *S,
     806                 :                                                         SourceLocation StartLoc,
     807                 :                                                         Declarator &D,
     808                 :                                                         SourceLocation EqualLoc,
     809                0:                                                         ExprArg AssignExprVal) {
     810                0:       Out << __FUNCTION__ << "\n";
     811                0:       return ExprEmpty();
     812                 :     }
     813                 : 
     814                 :     virtual OwningExprResult ActOnCXXNew(SourceLocation StartLoc,
     815                 :                                          bool UseGlobal,
     816                 :                                          SourceLocation PlacementLParen,
     817                 :                                          MultiExprArg PlacementArgs,
     818                 :                                          SourceLocation PlacementRParen,
     819                 :                                          bool ParenTypeId, Declarator &D,
     820                 :                                          SourceLocation ConstructorLParen,
     821                 :                                          MultiExprArg ConstructorArgs,
     822                0:                                          SourceLocation ConstructorRParen) {
     823                0:       Out << __FUNCTION__ << "\n";
     824                0:       return ExprEmpty();
     825                 :     }
     826                 : 
     827                 :     virtual OwningExprResult ActOnCXXDelete(SourceLocation StartLoc,
     828                 :                                             bool UseGlobal, bool ArrayForm,
     829                0:                                             ExprArg Operand) {
     830                0:       Out << __FUNCTION__ << "\n";
     831                0:       return ExprEmpty();
     832                 :     }
     833                 : 
     834                 :     virtual OwningExprResult ActOnUnaryTypeTrait(UnaryTypeTrait OTT,
     835                 :                                                  SourceLocation KWLoc,
     836                 :                                                  SourceLocation LParen,
     837                 :                                                  TypeTy *Ty,
     838                0:                                                  SourceLocation RParen) {
     839                0:       Out << __FUNCTION__ << "\n";
     840                0:       return ExprEmpty();
     841                 :     }
     842                 :   };
     843                 : }
     844                 : 
     845                 : MinimalAction *clang::CreatePrintParserActionsAction(Preprocessor &PP,
     846                2:                                                      llvm::raw_ostream* OS) {
     847                2:   return new ParserPrintActions(PP, *OS);
     848                 : }

Generated: 2010-02-10 01:31 by zcov