[cfe-commits] r77320 - /cfe/trunk/lib/AST/StmtProfile.cpp

Douglas Gregor dgregor at apple.com
Tue Jul 28 08:27:20 PDT 2009


Author: dgregor
Date: Tue Jul 28 10:27:13 2009
New Revision: 77320

URL: http://llvm.org/viewvc/llvm-project?rev=77320&view=rev
Log:
Finish profile support for statements.

Modified:
    cfe/trunk/lib/AST/StmtProfile.cpp

Modified: cfe/trunk/lib/AST/StmtProfile.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtProfile.cpp?rev=77320&r1=77319&r2=77320&view=diff

==============================================================================
--- cfe/trunk/lib/AST/StmtProfile.cpp (original)
+++ cfe/trunk/lib/AST/StmtProfile.cpp Tue Jul 28 10:27:13 2009
@@ -35,8 +35,8 @@
       : ID(ID), Context(Context), Canonical(Canonical) { }
     
     void VisitStmt(Stmt *S);
-#define STMT(Node, Base)
-#define EXPR(Node, Base) void Visit##Node(Node *S);
+    
+#define STMT(Node, Base) void Visit##Node(Node *S);
 #include "clang/AST/StmtNodes.def"
     
     /// \brief Visit a declaration that is referenced within an expression
@@ -71,6 +71,131 @@
     Visit(*C);
 }
 
+void StmtProfiler::VisitDeclStmt(DeclStmt *S) {
+  VisitStmt(S);
+  for (DeclStmt::decl_iterator D = S->decl_begin(), DEnd = S->decl_end();
+       D != DEnd; ++D)
+    VisitDecl(*D);
+}
+
+void StmtProfiler::VisitNullStmt(NullStmt *S) {
+  VisitStmt(S);
+}
+
+void StmtProfiler::VisitCompoundStmt(CompoundStmt *S) {
+  VisitStmt(S);
+}
+
+void StmtProfiler::VisitSwitchCase(SwitchCase *S) {
+  VisitStmt(S);
+}
+
+void StmtProfiler::VisitCaseStmt(CaseStmt *S) {
+  VisitStmt(S);
+}
+
+void StmtProfiler::VisitDefaultStmt(DefaultStmt *S) {
+  VisitStmt(S);
+}
+
+void StmtProfiler::VisitLabelStmt(LabelStmt *S) {
+  VisitStmt(S);
+  VisitName(S->getID());
+}
+
+void StmtProfiler::VisitIfStmt(IfStmt *S) {
+  VisitStmt(S);
+}
+
+void StmtProfiler::VisitWhileStmt(WhileStmt *S) {
+  VisitStmt(S);
+}
+
+void StmtProfiler::VisitDoStmt(DoStmt *S) {
+  VisitStmt(S);
+}
+
+void StmtProfiler::VisitForStmt(ForStmt *S) {
+  VisitStmt(S);
+}
+
+void StmtProfiler::VisitGotoStmt(GotoStmt *S) {
+  VisitStmt(S);
+  VisitName(S->getLabel()->getID());
+}
+
+void StmtProfiler::VisitIndirectGotoStmt(IndirectGotoStmt *S) {
+  VisitStmt(S);
+}
+
+void StmtProfiler::VisitContinueStmt(ContinueStmt *S) {
+  VisitStmt(S);
+}
+
+void StmtProfiler::VisitBreakStmt(BreakStmt *S) {
+  VisitStmt(S);
+}
+
+void StmtProfiler::VisitReturnStmt(ReturnStmt *S) {
+  VisitStmt(S);
+}
+
+void StmtProfiler::VisitAsmStmt(AsmStmt *S) {
+  VisitStmt(S);
+  ID.AddBoolean(S->isVolatile());
+  ID.AddBoolean(S->isSimple());
+  VisitStringLiteral(S->getAsmString());
+  ID.AddInteger(S->getNumOutputs());
+  for (unsigned I = 0, N = S->getNumOutputs(); I != N; ++I) {
+    ID.AddString(S->getOutputName(I));
+    VisitStringLiteral(S->getOutputConstraintLiteral(I));
+  }
+  ID.AddInteger(S->getNumInputs());
+  for (unsigned I = 0, N = S->getNumInputs(); I != N; ++I) {
+    ID.AddString(S->getInputName(I));
+    VisitStringLiteral(S->getInputConstraintLiteral(I));
+  }
+  ID.AddInteger(S->getNumClobbers());
+  for (unsigned I = 0, N = S->getNumClobbers(); I != N; ++I)
+    VisitStringLiteral(S->getClobber(I));
+}
+
+void StmtProfiler::VisitCXXCatchStmt(CXXCatchStmt *S) {
+  VisitStmt(S);
+  VisitType(S->getCaughtType());
+}
+
+void StmtProfiler::VisitCXXTryStmt(CXXTryStmt *S) {
+  VisitStmt(S);
+}
+
+void StmtProfiler::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) {
+  VisitStmt(S);
+}
+
+void StmtProfiler::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) {
+  VisitStmt(S);
+  ID.AddBoolean(S->hasEllipsis());
+  if (S->getCatchParamDecl())
+    VisitType(S->getCatchParamDecl()->getType());
+}
+
+void StmtProfiler::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
+  VisitStmt(S);
+}
+
+void StmtProfiler::VisitObjCAtTryStmt(ObjCAtTryStmt *S) {
+  VisitStmt(S);
+}
+
+void StmtProfiler::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) {
+  VisitStmt(S);
+}
+
+void StmtProfiler::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) {
+  VisitStmt(S);
+}
+
 void StmtProfiler::VisitExpr(Expr *S) {
   VisitStmt(S);
 }
@@ -195,7 +320,7 @@
 
 void StmtProfiler::VisitAddrLabelExpr(AddrLabelExpr *S) {
   VisitExpr(S);
-  ID.AddPointer(S->getLabel());
+  VisitName(S->getLabel()->getID());
 }
 
 void StmtProfiler::VisitStmtExpr(StmtExpr *S) {





More information about the cfe-commits mailing list