Home | History | Annotate | Download | only in AST

Lines Matching refs:Node

96     void VisitStmt(Stmt *Node) LLVM_ATTRIBUTE_UNUSED {
99 void VisitExpr(Expr *Node) LLVM_ATTRIBUTE_UNUSED {
102 void VisitCXXNamedCastExpr(CXXNamedCastExpr *Node);
106 void Visit##CLASS(CLASS *Node);
117 void StmtPrinter::PrintRawCompoundStmt(CompoundStmt *Node) {
119 for (auto *I : Node->body())
134 void StmtPrinter::VisitNullStmt(NullStmt *Node) {
138 void StmtPrinter::VisitDeclStmt(DeclStmt *Node) {
140 PrintRawDeclStmt(Node);
144 void StmtPrinter::VisitCompoundStmt(CompoundStmt *Node) {
146 PrintRawCompoundStmt(Node);
150 void StmtPrinter::VisitCaseStmt(CaseStmt *Node) {
152 PrintExpr(Node->getLHS());
153 if (Node->getRHS()) {
155 PrintExpr(Node->getRHS());
159 PrintStmt(Node->getSubStmt(), 0);
162 void StmtPrinter::VisitDefaultStmt(DefaultStmt *Node) {
164 PrintStmt(Node->getSubStmt(), 0);
167 void StmtPrinter::VisitLabelStmt(LabelStmt *Node) {
168 Indent(-1) << Node->getName() << ":\n";
169 PrintStmt(Node->getSubStmt(), 0);
172 void StmtPrinter::VisitAttributedStmt(AttributedStmt *Node) {
173 for (const auto *Attr : Node->getAttrs()) {
177 PrintStmt(Node->getSubStmt(), 0);
220 void StmtPrinter::VisitSwitchStmt(SwitchStmt *Node) {
222 if (const DeclStmt *DS = Node->getConditionVariableDeclStmt())
225 PrintExpr(Node->getCond());
229 if (CompoundStmt *CS = dyn_cast<CompoundStmt>(Node->getBody())) {
235 PrintStmt(Node->getBody());
239 void StmtPrinter::VisitWhileStmt(WhileStmt *Node) {
241 if (const DeclStmt *DS = Node->getConditionVariableDeclStmt())
244 PrintExpr(Node->getCond());
246 PrintStmt(Node->getBody());
249 void StmtPrinter::VisitDoStmt(DoStmt *Node) {
251 if (CompoundStmt *CS = dyn_cast<CompoundStmt>(Node->getBody())) {
256 PrintStmt(Node->getBody());
261 PrintExpr(Node->getCond());
265 void StmtPrinter::VisitForStmt(ForStmt *Node) {
267 if (Node->getInit()) {
268 if (DeclStmt *DS = dyn_cast<DeclStmt>(Node->getInit()))
271 PrintExpr(cast<Expr>(Node->getInit()));
274 if (Node->getCond()) {
276 PrintExpr(Node->getCond());
279 if (Node->getInc()) {
281 PrintExpr(Node->getInc());
285 if (CompoundStmt *CS = dyn_cast<CompoundStmt>(Node->getBody())) {
290 PrintStmt(Node->getBody());
294 void StmtPrinter::VisitObjCForCollectionStmt(ObjCForCollectionStmt *Node) {
296 if (DeclStmt *DS = dyn_cast<DeclStmt>(Node->getElement()))
299 PrintExpr(cast<Expr>(Node->getElement()));
301 PrintExpr(Node->getCollection());
304 if (CompoundStmt *CS = dyn_cast<CompoundStmt>(Node->getBody())) {
309 PrintStmt(Node->getBody());
313 void StmtPrinter::VisitCXXForRangeStmt(CXXForRangeStmt *Node) {
317 Node->getLoopVariable()->print(OS, SubPolicy, IndentLevel);
319 PrintExpr(Node->getRangeInit());
321 PrintStmt(Node->getBody());
326 void StmtPrinter::VisitMSDependentExistsStmt(MSDependentExistsStmt *Node) {
328 if (Node->isIfExists())
334 = Node->getQualifierLoc().getNestedNameSpecifier())
337 OS << Node->getNameInfo() << ") ";
339 PrintRawCompoundStmt(Node->getSubStmt());
342 void StmtPrinter::VisitGotoStmt(GotoStmt *Node) {
343 Indent() << "goto " << Node->getLabel()->getName() << ";";
347 void StmtPrinter::VisitIndirectGotoStmt(IndirectGotoStmt *Node) {
349 PrintExpr(Node->getTarget());
354 void StmtPrinter::VisitContinueStmt(ContinueStmt *Node) {
359 void StmtPrinter::VisitBreakStmt(BreakStmt *Node) {
365 void StmtPrinter::VisitReturnStmt(ReturnStmt *Node) {
367 if (Node->getRetValue()) {
369 PrintExpr(Node->getRetValue());
376 void StmtPrinter::VisitGCCAsmStmt(GCCAsmStmt *Node) {
379 if (Node->isVolatile())
383 VisitStringLiteral(Node->getAsmString());
386 if (Node->getNumOutputs() != 0 || Node->getNumInputs() != 0 ||
387 Node->getNumClobbers() != 0)
390 for (unsigned i = 0, e = Node->getNumOutputs(); i != e; ++i) {
394 if (!Node->getOutputName(i).empty()) {
396 OS << Node->getOutputName(i);
400 VisitStringLiteral(Node->getOutputConstraintLiteral(i));
402 Visit(Node->getOutputExpr(i));
407 if (Node->getNumInputs() != 0 || Node->getNumClobbers() != 0)
410 for (unsigned i = 0, e = Node->getNumInputs(); i != e; ++i) {
414 if (!Node->getInputName(i).empty()) {
416 OS << Node->getInputName(i);
420 VisitStringLiteral(Node->getInputConstraintLiteral(i));
422 Visit(Node->getInputExpr(i));
427 if (Node->getNumClobbers() != 0)
430 for (unsigned i = 0, e = Node->getNumClobbers(); i != e; ++i) {
434 VisitStringLiteral(Node->getClobberStringLiteral(i));
441 void StmtPrinter::VisitMSAsmStmt(MSAsmStmt *Node) {
444 if (Node->hasBraces())
446 OS << Node->getAsmString() << "\n";
447 if (Node->hasBraces())
451 void StmtPrinter::VisitCapturedStmt(CapturedStmt *Node) {
452 PrintStmt(Node->getCapturedDecl()->getBody());
455 void StmtPrinter::VisitObjCAtTryStmt(ObjCAtTryStmt *Node) {
457 if (CompoundStmt *TS = dyn_cast<CompoundStmt>(Node->getTryBody())) {
462 for (unsigned I = 0, N = Node->getNumCatchStmts(); I != N; ++I) {
463 ObjCAtCatchStmt *catchStmt = Node->getCatchStmt(I);
477 Node->getFinallyStmt())) {
484 void StmtPrinter::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *Node) {
487 void StmtPrinter::VisitObjCAtCatchStmt (ObjCAtCatchStmt *Node) {
491 void StmtPrinter::VisitObjCAtThrowStmt(ObjCAtThrowStmt *Node) {
493 if (Node->getThrowExpr()) {
495 PrintExpr(Node->getThrowExpr());
500 void StmtPrinter::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *Node) {
502 PrintExpr(Node->getSynchExpr());
504 PrintRawCompoundStmt(Node->getSynchBody());
508 void StmtPrinter::VisitObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *Node) {
510 PrintRawCompoundStmt(dyn_cast<CompoundStmt>(Node->getSubStmt()));
514 void StmtPrinter::PrintRawCXXCatchStmt(CXXCatchStmt *Node) {
516 if (Decl *ExDecl = Node->getExceptionDecl())
521 PrintRawCompoundStmt(cast<CompoundStmt>(Node->getHandlerBlock()));
524 void StmtPrinter::VisitCXXCatchStmt(CXXCatchStmt *Node) {
526 PrintRawCXXCatchStmt(Node);
530 void StmtPrinter::VisitCXXTryStmt(CXXTryStmt *Node) {
532 PrintRawCompoundStmt(Node->getTryBlock());
533 for (unsigned i = 0, e = Node->getNumHandlers(); i < e; ++i) {
535 PrintRawCXXCatchStmt(Node->getHandler(i));
540 void StmtPrinter::VisitSEHTryStmt(SEHTryStmt *Node) {
541 Indent() << (Node->getIsCXXTry() ? "try " : "__try ");
542 PrintRawCompoundStmt(Node->getTryBlock());
543 SEHExceptStmt *E = Node->getExceptHandler();
544 SEHFinallyStmt *F = Node->getFinallyHandler();
554 void StmtPrinter::PrintRawSEHFinallyStmt(SEHFinallyStmt *Node) {
556 PrintRawCompoundStmt(Node->getBlock());
560 void StmtPrinter::PrintRawSEHExceptHandler(SEHExceptStmt *Node) {
562 VisitExpr(Node->getFilterExpr());
564 PrintRawCompoundStmt(Node->getBlock());
568 void StmtPrinter::VisitSEHExceptStmt(SEHExceptStmt *Node) {
570 PrintRawSEHExceptHandler(Node);
574 void StmtPrinter::VisitSEHFinallyStmt(SEHFinallyStmt *Node) {
576 PrintRawSEHFinallyStmt(Node);
580 void StmtPrinter::VisitSEHLeaveStmt(SEHLeaveStmt *Node) {
595 void VisitOMPClauseList(T *Node, char StartSym);
604 void OMPClausePrinter::VisitOMPIfClause(OMPIfClause *Node) {
606 if (Node->getNameModifier() != OMPD_unknown)
607 OS << getOpenMPDirectiveName(Node->getNameModifier()) << ": ";
608 Node->getCondition()->printPretty(OS, nullptr, Policy, 0);
612 void OMPClausePrinter::VisitOMPFinalClause(OMPFinalClause *Node) {
614 Node->getCondition()->printPretty(OS, nullptr, Policy, 0);
618 void OMPClausePrinter::VisitOMPNumThreadsClause(OMPNumThreadsClause *Node) {
620 Node->getNumThreads()->printPretty(OS, nullptr, Policy, 0);
624 void OMPClausePrinter::VisitOMPSafelenClause(OMPSafelenClause *Node) {
626 Node->getSafelen()->printPretty(OS, nullptr, Policy, 0);
630 Node) {
632 Node->getSimdlen()->printPretty(OS, nullptr, Policy, 0);
636 void OMPClausePrinter::VisitOMPCollapseClause(OMPCollapseClause *Node) {
638 Node->getNumForLoops()->printPretty(OS, nullptr, Policy, 0);
642 void OMPClausePrinter::VisitOMPDefaultClause(OMPDefaultClause *Node) {
644 << getOpenMPSimpleClauseTypeName(OMPC_default, Node->getDefaultKind())
648 void OMPClausePrinter::VisitOMPProcBindClause(OMPProcBindClause *Node) {
650 << getOpenMPSimpleClauseTypeName(OMPC_proc_bind, Node->getProcBindKind())
654 void OMPClausePrinter::VisitOMPScheduleClause(OMPScheduleClause *Node) {
656 if (Node->getFirstScheduleModifier() != OMPC_SCHEDULE_MODIFIER_unknown) {
658 Node->getFirstScheduleModifier());
659 if (Node->getSecondScheduleModifier() != OMPC_SCHEDULE_MODIFIER_unknown) {
662 Node->getSecondScheduleModifier());
666 OS << getOpenMPSimpleClauseTypeName(OMPC_schedule, Node->getScheduleKind());
667 if (auto *E = Node->getChunkSize()) {
674 void OMPClausePrinter::VisitOMPOrderedClause(OMPOrderedClause *Node) {
676 if (auto *Num = Node->getNumForLoops()) {
721 void OMPClausePrinter::VisitOMPDeviceClause(OMPDeviceClause *Node) {
723 Node->getDevice()->printPretty(OS, nullptr, Policy, 0);
727 void OMPClausePrinter::VisitOMPNumTeamsClause(OMPNumTeamsClause *Node) {
729 Node->getNumTeams()->printPretty(OS, nullptr, Policy, 0);
733 void OMPClausePrinter::VisitOMPThreadLimitClause(OMPThreadLimitClause *Node) {
735 Node->getThreadLimit()->printPretty(OS, nullptr, Policy, 0);
739 void OMPClausePrinter::VisitOMPPriorityClause(OMPPriorityClause *Node) {
741 Node->getPriority()->printPretty(OS, nullptr, Policy, 0);
745 void OMPClausePrinter::VisitOMPGrainsizeClause(OMPGrainsizeClause *Node) {
747 Node->getGrainsize()->printPretty(OS, nullptr, Policy, 0);
751 void OMPClausePrinter::VisitOMPNumTasksClause(OMPNumTasksClause *Node) {
753 Node->getNumTasks()->printPretty(OS, nullptr, Policy, 0);
757 void OMPClausePrinter::VisitOMPHintClause(OMPHintClause *Node) {
759 Node->getHint()->printPretty(OS, nullptr, Policy, 0);
764 void OMPClausePrinter::VisitOMPClauseList(T *Node, char StartSym) {
765 for (typename T::varlist_iterator I = Node->varlist_begin(),
766 E = Node->varlist_end();
769 OS << (I == Node->varlist_begin() ? StartSym : ',');
780 void OMPClausePrinter::VisitOMPPrivateClause(OMPPrivateClause *Node) {
781 if (!Node->varlist_empty()) {
783 VisitOMPClauseList(Node, '(');
788 void OMPClausePrinter::VisitOMPFirstprivateClause(OMPFirstprivateClause *Node) {
789 if (!Node->varlist_empty()) {
791 VisitOMPClauseList(Node, '(');
796 void OMPClausePrinter::VisitOMPLastprivateClause(OMPLastprivateClause *Node) {
797 if (!Node->varlist_empty()) {
799 VisitOMPClauseList(Node, '(');
804 void OMPClausePrinter::VisitOMPSharedClause(OMPSharedClause *Node) {
805 if (!Node->varlist_empty()) {
807 VisitOMPClauseList(Node, '(');
812 void OMPClausePrinter::VisitOMPReductionClause(OMPReductionClause *Node) {
813 if (!Node->varlist_empty()) {
816 Node->getQualifierLoc().getNestedNameSpecifier();
818 Node->getNameInfo().getName().getCXXOverloadedOperator();
826 OS << Node->getNameInfo();
829 VisitOMPClauseList(Node, ' ');
834 void OMPClausePrinter::VisitOMPLinearClause(OMPLinearClause *Node) {
835 if (!Node->varlist_empty()) {
837 if (Node->getModifierLoc().isValid()) {
839 << getOpenMPSimpleClauseTypeName(OMPC_linear, Node->getModifier());
841 VisitOMPClauseList(Node, '(');
842 if (Node->getModifierLoc().isValid())
844 if (Node->getStep() != nullptr) {
846 Node->getStep()->printPretty(OS, nullptr, Policy, 0);
852 void OMPClausePrinter::VisitOMPAlignedClause(OMPAlignedClause *Node) {
853 if (!Node->varlist_empty()) {
855 VisitOMPClauseList(Node, '(');
856 if (Node->getAlignment() != nullptr) {
858 Node->getAlignment()->printPretty(OS, nullptr, Policy, 0);
864 void OMPClausePrinter::VisitOMPCopyinClause(OMPCopyinClause *Node) {
865 if (!Node->varlist_empty()) {
867 VisitOMPClauseList(Node, '(');
872 void OMPClausePrinter::VisitOMPCopyprivateClause(OMPCopyprivateClause *Node) {
873 if (!Node->varlist_empty()) {
875 VisitOMPClauseList(Node, '(');
880 void OMPClausePrinter::VisitOMPFlushClause(OMPFlushClause *Node) {
881 if (!Node->varlist_empty()) {
882 VisitOMPClauseList(Node, '(');
887 void OMPClausePrinter::VisitOMPDependClause(OMPDependClause *Node) {
889 OS << getOpenMPSimpleClauseTypeName(Node->getClauseKind(),
890 Node->getDependencyKind());
891 if (!Node->varlist_empty()) {
893 VisitOMPClauseList(Node, ' ');
898 void OMPClausePrinter::VisitOMPMapClause(OMPMapClause *Node) {
899 if (!Node->varlist_empty()) {
901 if (Node->getMapType() != OMPC_MAP_unknown) {
902 if (Node->getMapTypeModifier() != OMPC_MAP_unknown) {
904 Node->getMapTypeModifier());
907 OS << getOpenMPSimpleClauseTypeName(OMPC_map, Node->getMapType());
910 VisitOMPClauseList(Node, ' ');
915 void OMPClausePrinter::VisitOMPToClause(OMPToClause *Node) {
916 if (!Node->varlist_empty()) {
918 VisitOMPClauseList(Node, '(');
923 void OMPClausePrinter::VisitOMPFromClause(OMPFromClause *Node) {
924 if (!Node->varlist_empty()) {
926 VisitOMPClauseList(Node, '(');
931 void OMPClausePrinter::VisitOMPDistScheduleClause(OMPDistScheduleClause *Node) {
933 OMPC_dist_schedule, Node->getDistScheduleKind());
934 if (auto *E = Node->getChunkSize()) {
941 void OMPClausePrinter::VisitOMPDefaultmapClause(OMPDefaultmapClause *Node) {
944 Node->getDefaultmapModifier());
947 Node->getDefaultmapKind());
951 void OMPClausePrinter::VisitOMPUseDevicePtrClause(OMPUseDevicePtrClause *Node) {
952 if (!Node->varlist_empty()) {
954 VisitOMPClauseList(Node, '(');
959 void OMPClausePrinter::VisitOMPIsDevicePtrClause(OMPIsDevicePtrClause *Node) {
960 if (!Node->varlist_empty()) {
962 VisitOMPClauseList(Node, '(');
990 void StmtPrinter::VisitOMPParallelDirective(OMPParallelDirective *Node) {
992 PrintOMPExecutableDirective(Node);
995 void StmtPrinter::VisitOMPSimdDirective(OMPSimdDirective *Node) {
997 PrintOMPExecutableDirective(Node);
1000 void StmtPrinter::VisitOMPForDirective(OMPForDirective *Node) {
1002 PrintOMPExecutableDirective(Node);
1005 void StmtPrinter::VisitOMPForSimdDirective(OMPForSimdDirective *Node) {
1007 PrintOMPExecutableDirective(Node);
1010 void StmtPrinter::VisitOMPSectionsDirective(OMPSectionsDirective *Node) {
1012 PrintOMPExecutableDirective(Node);
1015 void StmtPrinter::VisitOMPSectionDirective(OMPSectionDirective *Node) {
1017 PrintOMPExecutableDirective(Node);
1020 void StmtPrinter::VisitOMPSingleDirective(OMPSingleDirective *Node) {
1022 PrintOMPExecutableDirective(Node);
1025 void StmtPrinter::VisitOMPMasterDirective(OMPMasterDirective *Node) {
1027 PrintOMPExecutableDirective(Node);
1030 void StmtPrinter::VisitOMPCriticalDirective(OMPCriticalDirective *Node) {
1032 if (Node->getDirectiveName().getName()) {
1034 Node->getDirectiveName().printName(OS);
1038 PrintOMPExecutableDirective(Node);
1041 void StmtPrinter::VisitOMPParallelForDirective(OMPParallelForDirective *Node) {
1043 PrintOMPExecutableDirective(Node);
1047 OMPParallelForSimdDirective *Node) {
1049 PrintOMPExecutableDirective(Node);
1053 OMPParallelSectionsDirective *Node) {
1055 PrintOMPExecutableDirective(Node);
1058 void StmtPrinter::VisitOMPTaskDirective(OMPTaskDirective *Node) {
1060 PrintOMPExecutableDirective(Node);
1063 void StmtPrinter::VisitOMPTaskyieldDirective(OMPTaskyieldDirective *Node) {
1065 PrintOMPExecutableDirective(Node);
1068 void StmtPrinter::VisitOMPBarrierDirective(OMPBarrierDirective *Node) {
1070 PrintOMPExecutableDirective(Node);
1073 void StmtPrinter::VisitOMPTaskwaitDirective(OMPTaskwaitDirective *Node) {
1075 PrintOMPExecutableDirective(Node);
1078 void StmtPrinter::VisitOMPTaskgroupDirective(OMPTaskgroupDirective *Node) {
1080 PrintOMPExecutableDirective(Node);
1083 void StmtPrinter::VisitOMPFlushDirective(OMPFlushDirective *Node) {
1085 PrintOMPExecutableDirective(Node);
1088 void StmtPrinter::VisitOMPOrderedDirective(OMPOrderedDirective *Node) {
1090 PrintOMPExecutableDirective(Node);
1093 void StmtPrinter::VisitOMPAtomicDirective(OMPAtomicDirective *Node) {
1095 PrintOMPExecutableDirective(Node);
1098 void StmtPrinter::VisitOMPTargetDirective(OMPTargetDirective *Node) {
1100 PrintOMPExecutableDirective(Node);
1103 void StmtPrinter::VisitOMPTargetDataDirective(OMPTargetDataDirective *Node) {
1105 PrintOMPExecutableDirective(Node);
1109 OMPTargetEnterDataDirective *Node) {
1111 PrintOMPExecutableDirective(Node);
1115 OMPTargetExitDataDirective *Node) {
1117 PrintOMPExecutableDirective(Node);
1121 OMPTargetParallelDirective *Node) {
1123 PrintOMPExecutableDirective(Node);
1127 OMPTargetParallelForDirective *Node) {
1129 PrintOMPExecutableDirective(Node);
1132 void StmtPrinter::VisitOMPTeamsDirective(OMPTeamsDirective *Node) {
1134 PrintOMPExecutableDirective(Node);
1138 OMPCancellationPointDirective *Node) {
1140 << getOpenMPDirectiveName(Node->getCancelRegion());
1141 PrintOMPExecutableDirective(Node);
1144 void StmtPrinter::VisitOMPCancelDirective(OMPCancelDirective *Node) {
1146 << getOpenMPDirectiveName(Node->getCancelRegion()) << " ";
1147 PrintOMPExecutableDirective(Node);
1150 void StmtPrinter::VisitOMPTaskLoopDirective(OMPTaskLoopDirective *Node) {
1152 PrintOMPExecutableDirective(Node);
1156 OMPTaskLoopSimdDirective *Node) {
1158 PrintOMPExecutableDirective(Node);
1161 void StmtPrinter::VisitOMPDistributeDirective(OMPDistributeDirective *Node) {
1163 PrintOMPExecutableDirective(Node);
1167 OMPTargetUpdateDirective *Node) {
1169 PrintOMPExecutableDirective(Node);
1173 OMPDistributeParallelForDirective *Node) {
1175 PrintOMPExecutableDirective(Node);
1179 OMPDistributeParallelForSimdDirective *Node) {
1181 PrintOMPExecutableDirective(Node);
1185 OMPDistributeSimdDirective *Node) {
1187 PrintOMPExecutableDirective(Node);
1191 Node) {
1193 PrintOMPExecutableDirective(Node);
1200 void StmtPrinter::VisitDeclRefExpr(DeclRefExpr *Node) {
1201 if (auto *OCED = dyn_cast<OMPCapturedExprDecl>(Node->getDecl())) {
1205 if (NestedNameSpecifier *Qualifier = Node->getQualifier())
1207 if (Node->hasTemplateKeyword())
1209 OS << Node->getNameInfo();
1210 if (Node->hasExplicitTemplateArgs())
1212 OS, Node->template_arguments(), Policy);
1216 DependentScopeDeclRefExpr *Node) {
1217 if (NestedNameSpecifier *Qualifier = Node->getQualifier())
1219 if (Node->hasTemplateKeyword())
1221 OS << Node->getNameInfo();
1222 if (Node->hasExplicitTemplateArgs())
1224 OS, Node->template_arguments(), Policy);
1227 void StmtPrinter::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *Node) {
1228 if (Node->getQualifier())
1229 Node->getQualifier()->print(OS, Policy);
1230 if (Node->hasTemplateKeyword())
1232 OS << Node->getNameInfo();
1233 if (Node->hasExplicitTemplateArgs())
1235 OS, Node->template_arguments(), Policy);
1238 void StmtPrinter::VisitObjCIvarRefExpr(ObjCIvarRefExpr *Node) {
1239 if (Node->getBase()) {
1240 PrintExpr(Node->getBase());
1241 OS << (Node->isArrow() ? "->" : ".");
1243 OS << *Node->getDecl();
1246 void StmtPrinter::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *Node) {
1247 if (Node->isSuperReceiver())
1249 else if (Node->isObjectReceiver() && Node->getBase()) {
1250 PrintExpr(Node->getBase());
1252 } else if (Node->isClassReceiver() && Node->getClassReceiver()) {
1253 OS << Node->getClassReceiver()->getName() << ".";
1256 if (Node->isImplicitProperty())
1257 Node->getImplicitPropertyGetter()->getSelector().print(OS);
1259 OS << Node->getExplicitProperty()->getName();
1262 void StmtPrinter::VisitObjCSubscriptRefExpr(ObjCSubscriptRefExpr *Node) {
1264 PrintExpr(Node->getBaseExpr());
1266 PrintExpr(Node->getKeyExpr());
1270 void StmtPrinter::VisitPredefinedExpr(PredefinedExpr *Node) {
1271 OS << PredefinedExpr::getIdentTypeName(Node->getIdentType());
1274 void StmtPrinter::VisitCharacterLiteral(CharacterLiteral *Node) {
1275 unsigned value = Node->getValue();
1277 switch (Node->getKind()) {
1323 if ((value & ~0xFFu) == ~0xFFu && Node->getKind() == CharacterLiteral::Ascii)
1336 void StmtPrinter::VisitIntegerLiteral(IntegerLiteral *Node) {
1337 bool isSigned = Node->getType()->isSignedIntegerType();
1338 OS << Node->getValue().toString(10, isSigned);
1341 switch (Node->getType()->getAs<BuiltinType>()->getKind()) {
1357 static void PrintFloatingLiteral(raw_ostream &OS, FloatingLiteral *Node,
1360 Node->getValue().toString(Str);
1369 switch (Node->getType()->getAs<BuiltinType>()->getKind()) {
1379 void StmtPrinter::VisitFloatingLiteral(FloatingLiteral *Node) {
1380 PrintFloatingLiteral(OS, Node, /*PrintSuffix=*/true);
1383 void StmtPrinter::VisitImaginaryLiteral(ImaginaryLiteral *Node) {
1384 PrintExpr(Node->getSubExpr());
1391 void StmtPrinter::VisitParenExpr(ParenExpr *Node) {
1393 PrintExpr(Node->getSubExpr());
1396 void StmtPrinter::VisitUnaryOperator(UnaryOperator *Node) {
1397 if (!Node->isPostfix()) {
1398 OS << UnaryOperator::getOpcodeStr(Node->getOpcode());
1402 switch (Node->getOpcode()) {
1411 if (isa<UnaryOperator>(Node->getSubExpr()))
1416 PrintExpr(Node->getSubExpr());
1418 if (Node->isPostfix())
1419 OS << UnaryOperator::getOpcodeStr(Node->getOpcode());
1422 void StmtPrinter::VisitOffsetOfExpr(OffsetOfExpr *Node) {
1424 Node->getTypeSourceInfo()->getType().print(OS, Policy);
1427 for (unsigned i = 0, n = Node->getNumComponents(); i < n; ++i) {
1428 OffsetOfNode ON = Node->getComponent(i);
1430 // Array node
1432 PrintExpr(Node->getIndexExpr(ON.getArrayExprIndex()));
1442 // Field or identifier node.
1456 void StmtPrinter::VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *Node){
1457 switch(Node->getKind()) {
1476 if (Node->isArgumentType()) {
1478 Node->getArgumentType().print(OS, Policy);
1482 PrintExpr(Node->getArgumentExpr());
1486 void StmtPrinter::VisitGenericSelectionExpr(GenericSelectionExpr *Node) {
1488 PrintExpr(Node->getControllingExpr());
1489 for (unsigned i = 0; i != Node->getNumAssocs(); ++i) {
1491 QualType T = Node->getAssocType(i);
1497 PrintExpr(Node->getAssocExpr(i));
1502 void StmtPrinter::VisitArraySubscriptExpr(ArraySubscriptExpr *Node) {
1503 PrintExpr(Node->getLHS());
1505 PrintExpr(Node->getRHS());
1509 void StmtPrinter::VisitOMPArraySectionExpr(OMPArraySectionExpr *Node) {
1510 PrintExpr(Node->getBase());
1512 if (Node->getLowerBound())
1513 PrintExpr(Node->getLowerBound());
1514 if (Node->getColonLoc().isValid()) {
1516 if (Node->getLength())
1517 PrintExpr(Node->getLength());
1540 void StmtPrinter::VisitMemberExpr(MemberExpr *Node) {
1542 PrintExpr(Node->getBase());
1544 MemberExpr *ParentMember = dyn_cast<MemberExpr>(Node->getBase());
1549 OS << (Node->isArrow() ? "->" : ".");
1551 if (FieldDecl *FD = dyn_cast<FieldDecl>(Node->getMemberDecl()))
1555 if (NestedNameSpecifier *Qualifier = Node->getQualifier())
1557 if (Node->hasTemplateKeyword())
1559 OS << Node->getMemberNameInfo();
1560 if (Node->hasExplicitTemplateArgs())
1562 OS, Node->template_arguments(), Policy);
1564 void StmtPrinter::VisitObjCIsaExpr(ObjCIsaExpr *Node) {
1565 PrintExpr(Node->getBase());
1566 OS << (Node->isArrow() ? "->isa" : ".isa");
1569 void StmtPrinter::VisitExtVectorElementExpr(ExtVectorElementExpr *Node) {
1570 PrintExpr(Node->getBase());
1572 OS << Node->getAccessor().getName();
1574 void StmtPrinter::VisitCStyleCastExpr(CStyleCastExpr *Node) {
1576 Node->getTypeAsWritten().print(OS, Policy);
1578 PrintExpr(Node->getSubExpr());
1580 void StmtPrinter::VisitCompoundLiteralExpr(CompoundLiteralExpr *Node) {
1582 Node->getType().print(OS, Policy);
1584 PrintExpr(Node->getInitializer());
1586 void StmtPrinter::VisitImplicitCastExpr(ImplicitCastExpr *Node) {
1588 PrintExpr(Node->getSubExpr());
1590 void StmtPrinter::VisitBinaryOperator(BinaryOperator *Node) {
1591 PrintExpr(Node->getLHS());
1592 OS << " " << BinaryOperator::getOpcodeStr(Node->getOpcode()) << " ";
1593 PrintExpr(Node->getRHS());
1595 void StmtPrinter::VisitCompoundAssignOperator(CompoundAssignOperator *Node) {
1596 PrintExpr(Node->getLHS());
1597 OS << " " << BinaryOperator::getOpcodeStr(Node->getOpcode()) << " ";
1598 PrintExpr(Node->getRHS());
1600 void StmtPrinter::VisitConditionalOperator(ConditionalOperator *Node) {
1601 PrintExpr(Node->getCond());
1603 PrintExpr(Node->getLHS());
1605 PrintExpr(Node->getRHS());
1611 StmtPrinter::VisitBinaryConditionalOperator(BinaryConditionalOperator *Node) {
1612 PrintExpr(Node->getCommon());
1614 PrintExpr(Node->getFalseExpr());
1616 void StmtPrinter::VisitAddrLabelExpr(AddrLabelExpr *Node) {
1617 OS << "&&" << Node->getLabel()->getName();
1626 void StmtPrinter::VisitChooseExpr(ChooseExpr *Node) {
1628 PrintExpr(Node->getCond());
1630 PrintExpr(Node->getLHS());
1632 PrintExpr(Node->getRHS());
1640 void StmtPrinter::VisitShuffleVectorExpr(ShuffleVectorExpr *Node) {
1642 for (unsigned i = 0, e = Node->getNumSubExprs(); i != e; ++i) {
1644 PrintExpr(Node->getExpr(i));
1649 void StmtPrinter::VisitConvertVectorExpr(ConvertVectorExpr *Node) {
1651 PrintExpr(Node->getSrcExpr());
1653 Node->getType().print(OS, Policy);
1657 void StmtPrinter::VisitInitListExpr(InitListExpr* Node) {
1658 if (Node->getSyntacticForm()) {
1659 Visit(Node->getSyntacticForm());
1664 for (unsigned i = 0, e = Node->getNumInits(); i != e; ++i) {
1666 if (Node->getInit(i))
1667 PrintExpr(Node->getInit(i));
1674 void StmtPrinter::VisitParenListExpr(ParenListExpr* Node) {
1676 for (unsigned i = 0, e = Node->getNumExprs(); i != e; ++i) {
1678 PrintExpr(Node->getExpr(i));
1683 void StmtPrinter::VisitDesignatedInitExpr(DesignatedInitExpr *Node) {
1685 for (const DesignatedInitExpr::Designator &D : Node->designators()) {
1698 PrintExpr(Node->getArrayIndex(D));
1700 PrintExpr(Node->getArrayRangeStart(D));
1702 PrintExpr(Node->getArrayRangeEnd(D));
1712 PrintExpr(Node->getInit());
1716 DesignatedInitUpdateExpr *Node) {
1719 PrintExpr(Node->getBase());
1723 PrintExpr(Node->getUpdater());
1727 void StmtPrinter::VisitNoInitExpr(NoInitExpr *Node) {
1731 void StmtPrinter::VisitImplicitValueInitExpr(ImplicitValueInitExpr *Node) {
1732 if (Node->getType()->getAsCXXRecordDecl()) {
1734 Node->getType().print(OS, Policy);
1738 Node->getType().print(OS, Policy);
1740 if (Node->getType()->isRecordType())
1747 void StmtPrinter::VisitVAArgExpr(VAArgExpr *Node) {
1749 PrintExpr(Node->getSubExpr());
1751 Node->getType().print(OS, Policy);
1755 void StmtPrinter::VisitPseudoObjectExpr(PseudoObjectExpr *Node) {
1756 PrintExpr(Node->getSyntacticForm());
1759 void StmtPrinter::VisitAtomicExpr(AtomicExpr *Node) {
1761 switch (Node->getOp()) {
1772 PrintExpr(Node->getPtr());
1773 if (Node->getOp() != AtomicExpr::AO__c11_atomic_load &&
1774 Node->getOp() != AtomicExpr::AO__atomic_load_n) {
1776 PrintExpr(Node
1778 if (Node->getOp() == AtomicExpr::AO__atomic_exchange ||
1779 Node->isCmpXChg()) {
1781 PrintExpr(Node->getVal2());
1783 if (Node->getOp() == AtomicExpr::AO__atomic_compare_exchange ||
1784 Node->getOp() == AtomicExpr::AO__atomic_compare_exchange_n) {
1786 PrintExpr(Node->getWeak());
1788 if (Node->getOp() != AtomicExpr::AO__c11_atomic_init) {
1790 PrintExpr(Node->getOrder());
1792 if (Node->isCmpXChg()) {
1794 PrintExpr(Node->getOrderFail());
1800 void StmtPrinter::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *Node) {
1808 OverloadedOperatorKind Kind = Node->getOperator();
1810 if (Node->getNumArgs() == 1) {
1812 PrintExpr(Node->getArg(0));
1814 PrintExpr(Node->getArg(0));
1818 PrintExpr(Node->getArg(0));
1820 PrintExpr(Node->getArg(0));
1822 for (unsigned ArgIdx = 1; ArgIdx < Node->getNumArgs(); ++ArgIdx) {
1825 if (!isa<CXXDefaultArgExpr>(Node->getArg(ArgIdx)))
1826 PrintExpr(Node->getArg(ArgIdx));
1830 PrintExpr(Node->getArg(0));
1832 PrintExpr(Node->getArg(1));
1834 } else if (Node->getNumArgs() == 1) {
1836 PrintExpr(Node->getArg(0));
1837 } else if (Node->getNumArgs() == 2) {
1838 PrintExpr(Node->getArg(0));
1840 PrintExpr(Node->getArg(1));
1846 void StmtPrinter::VisitCXXMemberCallExpr(CXXMemberCallExpr *Node) {
1848 CXXMethodDecl *MD = Node->getMethodDecl();
1850 PrintExpr(Node->getImplicitObjectArgument());
1853 VisitCallExpr(cast<CallExpr>(Node));
1856 void StmtPrinter::VisitCUDAKernelCallExpr(CUDAKernelCallExpr *Node) {
1857 PrintExpr(Node->getCallee());
1859 PrintCallArgs(Node->getConfig());
1861 PrintCallArgs(Node);
1865 void StmtPrinter::VisitCXXNamedCastExpr(CXXNamedCastExpr *Node) {
1866 OS << Node->getCastName() << '<';
1867 Node->getTypeAsWritten().print(OS, Policy);
1869 PrintExpr(Node->getSubExpr());
1873 void StmtPrinter::VisitCXXStaticCastExpr(CXXStaticCastExpr *Node) {
1874 VisitCXXNamedCastExpr(Node);
1877 void StmtPrinter::VisitCXXDynamicCastExpr(CXXDynamicCastExpr *Node) {
1878 VisitCXXNamedCastExpr(Node);
1881 void StmtPrinter::VisitCXXReinterpretCastExpr(CXXReinterpretCastExpr *Node) {
1882 VisitCXXNamedCastExpr(Node);
1885 void StmtPrinter::VisitCXXConstCastExpr(CXXConstCastExpr *Node) {
1886 VisitCXXNamedCastExpr(Node);
1889 void StmtPrinter::VisitCXXTypeidExpr(CXXTypeidExpr *Node) {
1891 if (Node->isTypeOperand()) {
1892 Node->getTypeOperandSourceInfo()->getType().print(OS, Policy);
1894 PrintExpr(Node->getExprOperand());
1899 void StmtPrinter::VisitCXXUuidofExpr(CXXUuidofExpr *Node) {
1901 if (Node->isTypeOperand()) {
1902 Node->getTypeOperandSourceInfo()->getType().print(OS, Policy);
1904 PrintExpr(Node->getExprOperand());
1909 void StmtPrinter::VisitMSPropertyRefExpr(MSPropertyRefExpr *Node) {
1910 PrintExpr(Node->getBaseExpr());
1911 if (Node->isArrow())
1916 Node->getQualifierLoc().getNestedNameSpecifier())
1918 OS << Node->getPropertyDecl()->getDeclName();
1921 void StmtPrinter::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *Node) {
1922 PrintExpr(Node->getBase());
1924 PrintExpr(Node->getIdx());
1928 void StmtPrinter::VisitUserDefinedLiteral(UserDefinedLiteral *Node) {
1929 switch (Node->getLiteralOperatorKind()) {
1931 OS << cast<StringLiteral>(Node->getArg(0)->IgnoreImpCasts())->getString();
1934 DeclRefExpr *DRE = cast<DeclRefExpr>(Node->getCallee()->IgnoreImpCasts());
1940 OS << "operator\"\"" << Node->getUDSuffix()->getName();
1956 IntegerLiteral *Int = cast<IntegerLiteral>(Node->getCookedLiteral());
1962 FloatingLiteral *Float = cast<FloatingLiteral>(Node->getCookedLiteral());
1968 PrintExpr(Node->getCookedLiteral());
1971 OS << Node->getUDSuffix()->getName();
1974 void StmtPrinter::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *Node) {
1975 OS << (Node->getValue() ? "true" : "false");
1978 void StmtPrinter::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *Node) {
1982 void StmtPrinter::VisitCXXThisExpr(CXXThisExpr *Node) {
1986 void StmtPrinter::VisitCXXThrowExpr(CXXThrowExpr *Node) {
1987 if (!Node->getSubExpr())
1991 PrintExpr(Node->getSubExpr());
1995 void StmtPrinter::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *Node) {
1999 void StmtPrinter::VisitCXXDefaultInitExpr(CXXDefaultInitExpr *Node) {
2003 void StmtPrinter::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *Node) {
2004 Node->getType().print(OS, Policy);
2007 if (Node->getLParenLoc().isValid())
2009 PrintExpr(Node->getSubExpr());
2010 if (Node->getLParenLoc().isValid())
2014 void StmtPrinter::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *Node) {
2015 PrintExpr(Node->getSubExpr());
2018 void StmtPrinter::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *Node) {
2019 Node->getType().print(OS, Policy);
2020 if (Node->isStdInitListInitialization())
2022 else if (Node->isListInitialization())
2026 for (CXXTemporaryObjectExpr::arg_iterator Arg = Node->arg_begin(),
2027 ArgEnd = Node->arg_end();
2031 if (Arg != Node->arg_begin())
2035 if (Node->isStdInitListInitialization())
2037 else if (Node->isListInitialization())
2043 void StmtPrinter::VisitLambdaExpr(LambdaExpr *Node) {
2046 switch (Node->getCaptureDefault()) {
2060 for (LambdaExpr::capture_iterator C = Node->explicit_capture_begin(),
2061 CEnd = Node->explicit_capture_end();
2076 if (Node->getCaptureDefault() != LCD_ByRef || Node->isInitCapture(C))
2088 if (Node->isInitCapture(C))
2093 if (Node->hasExplicitParameters()) {
2095 CXXMethodDecl *Method = Node->getCallOperator();
2113 if (Node->isMutable())
2123 if (Node->hasExplicitResultType()) {
2130 CompoundStmt *Body = Node->getBody();
2135 void StmtPrinter::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *Node) {
2136 if (TypeSourceInfo *TSInfo = Node->getTypeSourceInfo())
2139 Node->getType().print(OS, Policy);
2241 CXXUnresolvedConstructExpr *Node) {
2242 Node->getTypeAsWritten().print(OS, Policy);
2244 for (CXXUnresolvedConstructExpr::arg_iterator Arg = Node->arg_begin(),
2245 ArgEnd = Node->arg_end();
2247 if (Arg != Node->arg_begin())
2255 CXXDependentScopeMemberExpr *Node) {
2256 if (!Node->isImplicitAccess()) {
2257 PrintExpr(Node->getBase());
2258 OS << (Node->isArrow() ? "->" : ".");
2260 if (NestedNameSpecifier *Qualifier = Node->getQualifier())
2262 if (Node->hasTemplateKeyword())
2264 OS << Node->getMemberNameInfo();
2265 if (Node->hasExplicitTemplateArgs())
2267 OS, Node->template_arguments(), Policy);
2270 void StmtPrinter::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *Node) {
2271 if (!Node->isImplicitAccess()) {
2272 PrintExpr(Node->getBase());
2273 OS << (Node->isArrow() ? "->" : ".");
2275 if (NestedNameSpecifier *Qualifier = Node->getQualifier())
2277 if (Node->hasTemplateKeyword())
2279 OS << Node->getMemberNameInfo();
2280 if (Node->hasExplicitTemplateArgs())
2282 OS, Node->template_arguments(), Policy);
2352 SubstNonTypeTemplateParmPackExpr *Node) {
2353 OS << *Node->getParameterPack();
2357 SubstNonTypeTemplateParmExpr *Node) {
2358 Visit(Node->getReplacement());
2365 void StmtPrinter::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *Node){
2366 PrintExpr(Node->GetTemporaryExpr());
2410 void StmtPrinter::VisitObjCStringLiteral(ObjCStringLiteral *Node) {
2412 VisitStringLiteral(Node->getString());
2447 void StmtPrinter::VisitObjCEncodeExpr(ObjCEncodeExpr *Node) {
2449 Node->getEncodedType().print(OS, Policy);
2453 void StmtPrinter::VisitObjCSelectorExpr(ObjCSelectorExpr *Node) {
2455 Node->getSelector().print(OS);
2459 void StmtPrinter::VisitObjCProtocolExpr(ObjCProtocolExpr *Node) {
2460 OS << "@protocol(" << *Node->getProtocol() << ')';
2501 void StmtPrinter::VisitObjCBoolLiteralExpr(ObjCBoolLiteralExpr *Node) {
2502 OS << (Node->getValue() ? "__objc_yes" : "__objc_no");
2518 void StmtPrinter::VisitBlockExpr(BlockExpr *Node) {
2519 BlockDecl *BD = Node->getBlockDecl();
2522 const FunctionType *AFT = Node->getFunctionType();
2545 void StmtPrinter::VisitOpaqueValueExpr(OpaqueValueExpr *Node) {
2546 PrintExpr(Node->getSourceExpr());
2549 void StmtPrinter::VisitTypoExpr(TypoExpr *Node) {
2554 void StmtPrinter::VisitAsTypeExpr(AsTypeExpr *Node) {
2556 PrintExpr(Node->getSrcExpr());
2558 Node->getType().print(OS, Policy);