Lines Matching full:node

153     void VisitStmt(Stmt *Node) LLVM_ATTRIBUTE_UNUSED {
157 void VisitExpr(Expr *Node) LLVM_ATTRIBUTE_UNUSED {
161 void VisitCXXNamedCastExpr(CXXNamedCastExpr *Node);
165 void Visit##CLASS(CLASS *Node);
177 void StmtPrinter::PrintRawCompoundStmt(CompoundStmt *Node) {
178 assert(Node && "Compound statement cannot be null");
180 PrintFPPragmas(Node);
181 for (auto *I : Node->body())
256 void StmtPrinter::VisitNullStmt(NullStmt *Node) {
260 void StmtPrinter::VisitDeclStmt(DeclStmt *Node) {
262 PrintRawDeclStmt(Node);
266 void StmtPrinter::VisitCompoundStmt(CompoundStmt *Node) {
268 PrintRawCompoundStmt(Node);
272 void StmtPrinter::VisitCaseStmt(CaseStmt *Node) {
274 PrintExpr(Node->getLHS());
275 if (Node->getRHS()) {
277 PrintExpr(Node->getRHS());
281 PrintStmt(Node->getSubStmt(), 0);
284 void StmtPrinter::VisitDefaultStmt(DefaultStmt *Node) {
286 PrintStmt(Node->getSubStmt(), 0);
289 void StmtPrinter::VisitLabelStmt(LabelStmt *Node) {
290 Indent(-1) << Node->getName() << ":" << NL;
291 PrintStmt(Node->getSubStmt(), 0);
294 void StmtPrinter::VisitAttributedStmt(AttributedStmt *Node) {
295 llvm::ArrayRef<const Attr *> Attrs = Node->getAttrs();
302 PrintStmt(Node->getSubStmt(), 0);
363 void StmtPrinter::VisitSwitchStmt(SwitchStmt *Node) {
365 if (Node->getInit())
366 PrintInitStmt(Node->getInit(), 8);
367 if (const DeclStmt *DS = Node->getConditionVariableDeclStmt())
370 PrintExpr(Node->getCond());
372 PrintControlledStmt(Node->getBody());
375 void StmtPrinter::VisitWhileStmt(WhileStmt *Node) {
377 if (const DeclStmt *DS = Node->getConditionVariableDeclStmt())
380 PrintExpr(Node->getCond());
382 PrintStmt(Node->getBody());
385 void StmtPrinter::VisitDoStmt(DoStmt *Node) {
387 if (auto *CS = dyn_cast<CompoundStmt>(Node->getBody())) {
392 PrintStmt(Node->getBody());
397 PrintExpr(Node->getCond());
401 void StmtPrinter::VisitForStmt(ForStmt *Node) {
403 if (Node->getInit())
404 PrintInitStmt(Node->getInit(), 5);
406 OS << (Node->getCond() ? "; " : ";");
407 if (const DeclStmt *DS = Node->getConditionVariableDeclStmt())
409 else if (Node->getCond())
410 PrintExpr(Node->getCond());
412 if (Node->getInc()) {
414 PrintExpr(Node->getInc());
417 PrintControlledStmt(Node->getBody());
420 void StmtPrinter::VisitObjCForCollectionStmt(ObjCForCollectionStmt *Node) {
422 if (auto *DS = dyn_cast<DeclStmt>(Node->getElement()))
425 PrintExpr(cast<Expr>(Node->getElement()));
427 PrintExpr(Node->getCollection());
429 PrintControlledStmt(Node->getBody());
432 void StmtPrinter::VisitCXXForRangeStmt(CXXForRangeStmt *Node) {
434 if (Node->getInit())
435 PrintInitStmt(Node->getInit(), 5);
438 Node->getLoopVariable()->print(OS, SubPolicy, IndentLevel);
440 PrintExpr(Node->getRangeInit());
442 PrintControlledStmt(Node->getBody());
445 void StmtPrinter::VisitMSDependentExistsStmt(MSDependentExistsStmt *Node) {
447 if (Node->isIfExists())
453 = Node->getQualifierLoc().getNestedNameSpecifier())
456 OS << Node->getNameInfo() << ") ";
458 PrintRawCompoundStmt(Node->getSubStmt());
461 void StmtPrinter::VisitGotoStmt(GotoStmt *Node) {
462 Indent() << "goto " << Node->getLabel()->getName() << ";";
466 void StmtPrinter::VisitIndirectGotoStmt(IndirectGotoStmt *Node) {
468 PrintExpr(Node->getTarget());
473 void StmtPrinter::VisitContinueStmt(ContinueStmt *Node) {
478 void StmtPrinter::VisitBreakStmt(BreakStmt *Node) {
483 void StmtPrinter::VisitReturnStmt(ReturnStmt *Node) {
485 if (Node->getRetValue()) {
487 PrintExpr(Node->getRetValue());
493 void StmtPrinter::VisitGCCAsmStmt(GCCAsmStmt *Node) {
496 if (Node->isVolatile())
499 if (Node->isAsmGoto())
503 VisitStringLiteral(Node->getAsmString());
506 if (Node->getNumOutputs() != 0 || Node->getNumInputs() != 0 ||
507 Node->getNumClobbers() != 0 || Node->getNumLabels() != 0)
510 for (unsigned i = 0, e = Node->getNumOutputs(); i != e; ++i) {
514 if (!Node->getOutputName(i).empty()) {
516 OS << Node->getOutputName(i);
520 VisitStringLiteral(Node->getOutputConstraintLiteral(i));
522 Visit(Node->getOutputExpr(i));
527 if (Node->getNumInputs() != 0 || Node->getNumClobbers() != 0 ||
528 Node->getNumLabels() != 0)
531 for (unsigned i = 0, e = Node->getNumInputs(); i != e; ++i) {
535 if (!Node->getInputName(i).empty()) {
537 OS << Node->getInputName(i);
541 VisitStringLiteral(Node->getInputConstraintLiteral(i));
543 Visit(Node->getInputExpr(i));
548 if (Node->getNumClobbers() != 0 || Node->getNumLabels())
551 for (unsigned i = 0, e = Node->getNumClobbers(); i != e; ++i) {
555 VisitStringLiteral(Node->getClobberStringLiteral(i));
559 if (Node->getNumLabels() != 0)
562 for (unsigned i = 0, e = Node->getNumLabels(); i != e; ++i) {
565 OS << Node->getLabelName(i);
572 void StmtPrinter::VisitMSAsmStmt(MSAsmStmt *Node) {
575 if (Node->hasBraces())
577 OS << Node->getAsmString() << NL;
578 if (Node->hasBraces())
582 void StmtPrinter::VisitCapturedStmt(CapturedStmt *Node) {
583 PrintStmt(Node->getCapturedDecl()->getBody());
586 void StmtPrinter::VisitObjCAtTryStmt(ObjCAtTryStmt *Node) {
588 if (auto *TS = dyn_cast<CompoundStmt>(Node->getTryBody())) {
593 for (ObjCAtCatchStmt *catchStmt : Node->catch_stmts()) {
604 if (auto *FS = static_cast<ObjCAtFinallyStmt *>(Node->getFinallyStmt())) {
613 void StmtPrinter::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *Node) {
616 void StmtPrinter::VisitObjCAtCatchStmt (ObjCAtCatchStmt *Node) {
620 void StmtPrinter::VisitObjCAtThrowStmt(ObjCAtThrowStmt *Node) {
622 if (Node->getThrowExpr()) {
624 PrintExpr(Node->getThrowExpr());
630 ObjCAvailabilityCheckExpr *Node) {
634 void StmtPrinter::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *Node) {
636 PrintExpr(Node->getSynchExpr());
638 PrintRawCompoundStmt(Node->getSynchBody());
642 void StmtPrinter::VisitObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *Node) {
644 PrintRawCompoundStmt(cast<CompoundStmt>(Node->getSubStmt()));
648 void StmtPrinter::PrintRawCXXCatchStmt(CXXCatchStmt *Node) {
650 if (Decl *ExDecl = Node->getExceptionDecl())
655 PrintRawCompoundStmt(cast<CompoundStmt>(Node->getHandlerBlock()));
658 void StmtPrinter::VisitCXXCatchStmt(CXXCatchStmt *Node) {
660 PrintRawCXXCatchStmt(Node);
664 void StmtPrinter::VisitCXXTryStmt(CXXTryStmt *Node) {
666 PrintRawCompoundStmt(Node->getTryBlock());
667 for (unsigned i = 0, e = Node->getNumHandlers(); i < e; ++i) {
669 PrintRawCXXCatchStmt(Node->getHandler(i));
674 void StmtPrinter::VisitSEHTryStmt(SEHTryStmt *Node) {
675 Indent() << (Node->getIsCXXTry() ? "try " : "__try ");
676 PrintRawCompoundStmt(Node->getTryBlock());
677 SEHExceptStmt *E = Node->getExceptHandler();
678 SEHFinallyStmt *F = Node->getFinallyHandler();
688 void StmtPrinter::PrintRawSEHFinallyStmt(SEHFinallyStmt *Node) {
690 PrintRawCompoundStmt(Node->getBlock());
694 void StmtPrinter::PrintRawSEHExceptHandler(SEHExceptStmt *Node) {
696 VisitExpr(Node->getFilterExpr());
698 PrintRawCompoundStmt(Node->getBlock());
702 void StmtPrinter::VisitSEHExceptStmt(SEHExceptStmt *Node) {
704 PrintRawSEHExceptHandler(Node);
708 void StmtPrinter::VisitSEHFinallyStmt(SEHFinallyStmt *Node) {
710 PrintRawSEHFinallyStmt(Node);
714 void StmtPrinter::VisitSEHLeaveStmt(SEHLeaveStmt *Node) {
723 void StmtPrinter::VisitOMPCanonicalLoop(OMPCanonicalLoop *Node) {
724 PrintStmt(Node->getLoopStmt());
741 void StmtPrinter::VisitOMPMetaDirective(OMPMetaDirective *Node) {
743 PrintOMPExecutableDirective(Node);
746 void StmtPrinter::VisitOMPParallelDirective(OMPParallelDirective *Node) {
748 PrintOMPExecutableDirective(Node);
751 void StmtPrinter::VisitOMPSimdDirective(OMPSimdDirective *Node) {
753 PrintOMPExecutableDirective(Node);
756 void StmtPrinter::VisitOMPTileDirective(OMPTileDirective *Node) {
758 PrintOMPExecutableDirective(Node);
761 void StmtPrinter::VisitOMPUnrollDirective(OMPUnrollDirective *Node) {
763 PrintOMPExecutableDirective(Node);
766 void StmtPrinter::VisitOMPReverseDirective(OMPReverseDirective *Node) {
768 PrintOMPExecutableDirective(Node);
771 void StmtPrinter::VisitOMPInterchangeDirective(OMPInterchangeDirective *Node) {
773 PrintOMPExecutableDirective(Node);
776 void StmtPrinter::VisitOMPForDirective(OMPForDirective *Node) {
778 PrintOMPExecutableDirective(Node);
781 void StmtPrinter::VisitOMPForSimdDirective(OMPForSimdDirective *Node) {
783 PrintOMPExecutableDirective(Node);
786 void StmtPrinter::VisitOMPSectionsDirective(OMPSectionsDirective *Node) {
788 PrintOMPExecutableDirective(Node);
791 void StmtPrinter::VisitOMPSectionDirective(OMPSectionDirective *Node) {
793 PrintOMPExecutableDirective(Node);
796 void StmtPrinter::VisitOMPScopeDirective(OMPScopeDirective *Node) {
798 PrintOMPExecutableDirective(Node);
801 void StmtPrinter::VisitOMPSingleDirective(OMPSingleDirective *Node) {
803 PrintOMPExecutableDirective(Node);
806 void StmtPrinter::VisitOMPMasterDirective(OMPMasterDirective *Node) {
808 PrintOMPExecutableDirective(Node);
811 void StmtPrinter::VisitOMPCriticalDirective(OMPCriticalDirective *Node) {
813 if (Node->getDirectiveName().getName()) {
815 Node->getDirectiveName().printName(OS, Policy);
818 PrintOMPExecutableDirective(Node);
821 void StmtPrinter::VisitOMPParallelForDirective(OMPParallelForDirective *Node) {
823 PrintOMPExecutableDirective(Node);
827 OMPParallelForSimdDirective *Node) {
829 PrintOMPExecutableDirective(Node);
833 OMPParallelMasterDirective *Node) {
835 PrintOMPExecutableDirective(Node);
839 OMPParallelMaskedDirective *Node) {
841 PrintOMPExecutableDirective(Node);
845 OMPParallelSectionsDirective *Node) {
847 PrintOMPExecutableDirective(Node);
850 void StmtPrinter::VisitOMPTaskDirective(OMPTaskDirective *Node) {
852 PrintOMPExecutableDirective(Node);
855 void StmtPrinter::VisitOMPTaskyieldDirective(OMPTaskyieldDirective *Node) {
857 PrintOMPExecutableDirective(Node);
860 void StmtPrinter::VisitOMPBarrierDirective(OMPBarrierDirective *Node) {
862 PrintOMPExecutableDirective(Node);
865 void StmtPrinter::VisitOMPTaskwaitDirective(OMPTaskwaitDirective *Node) {
867 PrintOMPExecutableDirective(Node);
870 void StmtPrinter::VisitOMPErrorDirective(OMPErrorDirective *Node) {
872 PrintOMPExecutableDirective(Node);
875 void StmtPrinter::VisitOMPTaskgroupDirective(OMPTaskgroupDirective *Node) {
877 PrintOMPExecutableDirective(Node);
880 void StmtPrinter::VisitOMPFlushDirective(OMPFlushDirective *Node) {
882 PrintOMPExecutableDirective(Node);
885 void StmtPrinter::VisitOMPDepobjDirective(OMPDepobjDirective *Node) {
887 PrintOMPExecutableDirective(Node);
890 void StmtPrinter::VisitOMPScanDirective(OMPScanDirective *Node) {
892 PrintOMPExecutableDirective(Node);
895 void StmtPrinter::VisitOMPOrderedDirective(OMPOrderedDirective *Node) {
897 PrintOMPExecutableDirective(Node, Node->hasClausesOfKind<OMPDependClause>());
900 void StmtPrinter::VisitOMPAtomicDirective(OMPAtomicDirective *Node) {
902 PrintOMPExecutableDirective(Node);
905 void StmtPrinter::VisitOMPTargetDirective(OMPTargetDirective *Node) {
907 PrintOMPExecutableDirective(Node);
910 void StmtPrinter::VisitOMPTargetDataDirective(OMPTargetDataDirective *Node) {
912 PrintOMPExecutableDirective(Node);
916 OMPTargetEnterDataDirective *Node) {
918 PrintOMPExecutableDirective(Node, /*ForceNoStmt=*/true);
922 OMPTargetExitDataDirective *Node) {
924 PrintOMPExecutableDirective(Node, /*ForceNoStmt=*/true);
928 OMPTargetParallelDirective *Node) {
930 PrintOMPExecutableDirective(Node);
934 OMPTargetParallelForDirective *Node) {
936 PrintOMPExecutableDirective(Node);
939 void StmtPrinter::VisitOMPTeamsDirective(OMPTeamsDirective *Node) {
941 PrintOMPExecutableDirective(Node);
945 OMPCancellationPointDirective *Node) {
947 << getOpenMPDirectiveName(Node->getCancelRegion());
948 PrintOMPExecutableDirective(Node);
951 void StmtPrinter::VisitOMPCancelDirective(OMPCancelDirective *Node) {
953 << getOpenMPDirectiveName(Node->getCancelRegion());
954 PrintOMPExecutableDirective(Node);
957 void StmtPrinter::VisitOMPTaskLoopDirective(OMPTaskLoopDirective *Node) {
959 PrintOMPExecutableDirective(Node);
963 OMPTaskLoopSimdDirective *Node) {
965 PrintOMPExecutableDirective(Node);
969 OMPMasterTaskLoopDirective *Node) {
971 PrintOMPExecutableDirective(Node);
975 OMPMaskedTaskLoopDirective *Node) {
977 PrintOMPExecutableDirective(Node);
981 OMPMasterTaskLoopSimdDirective *Node) {
983 PrintOMPExecutableDirective(Node);
987 OMPMaskedTaskLoopSimdDirective *Node) {
989 PrintOMPExecutableDirective(Node);
993 OMPParallelMasterTaskLoopDirective *Node) {
995 PrintOMPExecutableDirective(Node);
999 OMPParallelMaskedTaskLoopDirective *Node) {
1001 PrintOMPExecutableDirective(Node);
1005 OMPParallelMasterTaskLoopSimdDirective *Node) {
1007 PrintOMPExecutableDirective(Node);
1011 OMPParallelMaskedTaskLoopSimdDirective *Node) {
1013 PrintOMPExecutableDirective(Node);
1016 void StmtPrinter::VisitOMPDistributeDirective(OMPDistributeDirective *Node) {
1018 PrintOMPExecutableDirective(Node);
1022 OMPTargetUpdateDirective *Node) {
1024 PrintOMPExecutableDirective(Node, /*ForceNoStmt=*/true);
1028 OMPDistributeParallelForDirective *Node) {
1030 PrintOMPExecutableDirective(Node);
1034 OMPDistributeParallelForSimdDirective *Node) {
1036 PrintOMPExecutableDirective(Node);
1040 OMPDistributeSimdDirective *Node) {
1042 PrintOMPExecutableDirective(Node);
1046 OMPTargetParallelForSimdDirective *Node) {
1048 PrintOMPExecutableDirective(Node);
1051 void StmtPrinter::VisitOMPTargetSimdDirective(OMPTargetSimdDirective *Node) {
1053 PrintOMPExecutableDirective(Node);
1057 OMPTeamsDistributeDirective *Node) {
1059 PrintOMPExecutableDirective(Node);
1063 OMPTeamsDistributeSimdDirective *Node) {
1065 PrintOMPExecutableDirective(Node);
1069 OMPTeamsDistributeParallelForSimdDirective *Node) {
1071 PrintOMPExecutableDirective(Node);
1075 OMPTeamsDistributeParallelForDirective *Node) {
1077 PrintOMPExecutableDirective(Node);
1080 void StmtPrinter::VisitOMPTargetTeamsDirective(OMPTargetTeamsDirective *Node) {
1082 PrintOMPExecutableDirective(Node);
1086 OMPTargetTeamsDistributeDirective *Node) {
1088 PrintOMPExecutableDirective(Node);
1092 OMPTargetTeamsDistributeParallelForDirective *Node) {
1094 PrintOMPExecutableDirective(Node);
1098 OMPTargetTeamsDistributeParallelForSimdDirective *Node) {
1100 PrintOMPExecutableDirective(Node);
1104 OMPTargetTeamsDistributeSimdDirective *Node) {
1106 PrintOMPExecutableDirective(Node);
1109 void StmtPrinter::VisitOMPInteropDirective(OMPInteropDirective *Node) {
1111 PrintOMPExecutableDirective(Node);
1114 void StmtPrinter::VisitOMPDispatchDirective(OMPDispatchDirective *Node) {
1116 PrintOMPExecutableDirective(Node);
1119 void StmtPrinter::VisitOMPMaskedDirective(OMPMaskedDirective *Node) {
1121 PrintOMPExecutableDirective(Node);
1124 void StmtPrinter::VisitOMPGenericLoopDirective(OMPGenericLoopDirective *Node) {
1126 PrintOMPExecutableDirective(Node);
1130 OMPTeamsGenericLoopDirective *Node) {
1132 PrintOMPExecutableDirective(Node);
1136 OMPTargetTeamsGenericLoopDirective *Node) {
1138 PrintOMPExecutableDirective(Node);
1142 OMPParallelGenericLoopDirective *Node) {
1144 PrintOMPExecutableDirective(Node);
1148 OMPTargetParallelGenericLoopDirective *Node) {
1150 PrintOMPExecutableDirective(Node);
1186 void StmtPrinter::VisitSourceLocExpr(SourceLocExpr *Node) {
1187 OS << Node->getBuiltinStr() << "()";
1190 void StmtPrinter::VisitEmbedExpr(EmbedExpr *Node) {
1194 void StmtPrinter::VisitConstantExpr(ConstantExpr *Node) {
1195 PrintExpr(Node->getSubExpr());
1198 void StmtPrinter::VisitDeclRefExpr(DeclRefExpr *Node) {
1199 if (const auto *OCED = dyn_cast<OMPCapturedExprDecl>(Node->getDecl())) {
1203 if (const auto *TPOD = dyn_cast<TemplateParamObjectDecl>(Node->getDecl())) {
1207 if (NestedNameSpecifier *Qualifier = Node->getQualifier())
1209 if (Node->hasTemplateKeyword())
1212 isa<ParmVarDecl, NonTypeTemplateParmDecl>(Node->getDecl()) &&
1213 Node->getDecl()->getIdentifier())
1214 OS << Node->getDecl()->getIdentifier()->deuglifiedName();
1216 Node->getNameInfo().printName(OS, Policy);
1217 if (Node->hasExplicitTemplateArgs()) {
1219 if (!Node->hadMultipleCandidates())
1220 if (auto *TD = dyn_cast<TemplateDecl>(Node->getDecl()))
1222 printTemplateArgumentList(OS, Node->template_arguments(), Policy, TPL);
1227 DependentScopeDeclRefExpr *Node) {
1228 if (NestedNameSpecifier *Qualifier = Node->getQualifier())
1230 if (Node->hasTemplateKeyword())
1232 OS << Node->getNameInfo();
1233 if (Node->hasExplicitTemplateArgs())
1234 printTemplateArgumentList(OS, Node->template_arguments(), Policy);
1237 void StmtPrinter::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *Node) {
1238 if (Node->getQualifier())
1239 Node->getQualifier()->print(OS, Policy);
1240 if (Node->hasTemplateKeyword())
1242 OS << Node->getNameInfo();
1243 if (Node->hasExplicitTemplateArgs())
1244 printTemplateArgumentList(OS, Node->template_arguments(), Policy);
1258 void StmtPrinter::VisitObjCIvarRefExpr(ObjCIvarRefExpr *Node) {
1259 if (Node->getBase()) {
1261 !isImplicitSelf(Node->getBase()->IgnoreImpCasts())) {
1262 PrintExpr(Node->getBase());
1263 OS << (Node->isArrow() ? "->" : ".");
1266 OS << *Node->getDecl();
1269 void StmtPrinter::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *Node) {
1270 if (Node->isSuperReceiver())
1272 else if (Node->isObjectReceiver() && Node->getBase()) {
1273 PrintExpr(Node->getBase());
1275 } else if (Node->isClassReceiver() && Node->getClassReceiver()) {
1276 OS << Node->getClassReceiver()->getName() << ".";
1279 if (Node->isImplicitProperty()) {
1280 if (const auto *Getter = Node->getImplicitPropertyGetter())
1284 Node->getImplicitPropertySetter()->getSelector());
1286 OS << Node->getExplicitProperty()->getName();
1289 void StmtPrinter::VisitObjCSubscriptRefExpr(ObjCSubscriptRefExpr *Node) {
1290 PrintExpr(Node->getBaseExpr());
1292 PrintExpr(Node->getKeyExpr());
1297 SYCLUniqueStableNameExpr *Node) {
1299 Node->getTypeSourceInfo()->getType().print(OS, Policy);
1303 void StmtPrinter::VisitPredefinedExpr(PredefinedExpr *Node) {
1304 OS << PredefinedExpr::getIdentKindName(Node->getIdentKind());
1307 void StmtPrinter::VisitCharacterLiteral(CharacterLiteral *Node) {
1308 CharacterLiteral::print(Node->getValue(), Node->getKind(), OS);
1328 void StmtPrinter::VisitIntegerLiteral(IntegerLiteral *Node) {
1329 if (Policy.ConstantsAsWritten && printExprAsWritten(OS, Node, Context))
1331 bool isSigned = Node->getType()->isSignedIntegerType();
1332 OS << toString(Node->getValue(), 10, isSigned);
1334 if (isa<BitIntType>(Node->getType())) {
1340 switch (Node->getType()->castAs<BuiltinType>()->getKind()) {
1364 void StmtPrinter::VisitFixedPointLiteral(FixedPointLiteral *Node) {
1365 if (Policy.ConstantsAsWritten && printExprAsWritten(OS, Node, Context))
1367 OS << Node->getValueAsString(/*Radix=*/10);
1369 switch (Node->getType()->castAs<BuiltinType>()->getKind()) {
1386 static void PrintFloatingLiteral(raw_ostream &OS, FloatingLiteral *Node,
1389 Node->getValue().toString(Str);
1398 switch (Node->getType()->castAs<BuiltinType>()->getKind()) {
1410 void StmtPrinter::VisitFloatingLiteral(FloatingLiteral *Node) {
1411 if (Policy.ConstantsAsWritten && printExprAsWritten(OS, Node, Context))
1413 PrintFloatingLiteral(OS, Node, /*PrintSuffix=*/true);
1416 void StmtPrinter::VisitImaginaryLiteral(ImaginaryLiteral *Node) {
1417 PrintExpr(Node->getSubExpr());
1425 void StmtPrinter::VisitParenExpr(ParenExpr *Node) {
1427 PrintExpr(Node->getSubExpr());
1431 void StmtPrinter::VisitUnaryOperator(UnaryOperator *Node) {
1432 if (!Node->isPostfix()) {
1433 OS << UnaryOperator::getOpcodeStr(Node->getOpcode());
1437 switch (Node->getOpcode()) {
1446 if (isa<UnaryOperator>(Node->getSubExpr()))
1451 PrintExpr(Node->getSubExpr());
1453 if (Node->isPostfix())
1454 OS << UnaryOperator::getOpcodeStr(Node->getOpcode());
1457 void StmtPrinter::VisitOffsetOfExpr(OffsetOfExpr *Node) {
1459 Node->getTypeSourceInfo()->getType().print(OS, Policy);
1462 for (unsigned i = 0, n = Node->getNumComponents(); i < n; ++i) {
1463 OffsetOfNode ON = Node->getComponent(i);
1465 // Array node
1467 PrintExpr(Node->getIndexExpr(ON.getArrayExprIndex()));
1477 // Field or identifier node.
1492 UnaryExprOrTypeTraitExpr *Node) {
1493 const char *Spelling = getTraitSpelling(Node->getKind());
1494 if (Node->getKind() == UETT_AlignOf) {
1505 if (Node->isArgumentType()) {
1507 Node->getArgumentType().print(OS, Policy);
1511 PrintExpr(Node->getArgumentExpr());
1515 void StmtPrinter::VisitGenericSelectionExpr(GenericSelectionExpr *Node) {
1517 if (Node->isExprPredicate())
1518 PrintExpr(Node->getControllingExpr());
1520 Node->getControllingType()->getType().print(OS, Policy);
1522 for (const GenericSelectionExpr::Association &Assoc : Node->associations()) {
1535 void StmtPrinter::VisitArraySubscriptExpr(ArraySubscriptExpr *Node) {
1536 PrintExpr(Node->getLHS());
1538 PrintExpr(Node->getRHS());
1542 void StmtPrinter::VisitMatrixSubscriptExpr(MatrixSubscriptExpr *Node) {
1543 PrintExpr(Node->getBase());
1545 PrintExpr(Node->getRowIdx());
1548 PrintExpr(Node->getColumnIdx());
1552 void StmtPrinter::VisitArraySectionExpr(ArraySectionExpr *Node) {
1553 PrintExpr(Node->getBase());
1555 if (Node->getLowerBound())
1556 PrintExpr(Node->getLowerBound());
1557 if (Node->getColonLocFirst().isValid()) {
1559 if (Node->getLength())
1560 PrintExpr(Node->getLength());
1562 if (Node->isOMPArraySection() && Node->getColonLocSecond().isValid()) {
1564 if (Node->getStride())
1565 PrintExpr(Node->getStride());
1570 void StmtPrinter::VisitOMPArrayShapingExpr(OMPArrayShapingExpr *Node) {
1572 for (Expr *E : Node->getDimensions()) {
1578 PrintExpr(Node->getBase());
1581 void StmtPrinter::VisitOMPIteratorExpr(OMPIteratorExpr *Node) {
1583 for (unsigned I = 0, E = Node->numOfIterators(); I < E; ++I) {
1584 auto *VD = cast<ValueDecl>(Node->getIteratorDecl(I));
1586 const OMPIteratorExpr::IteratorRange Range = Node->getIteratorRange(I);
1626 void StmtPrinter::VisitMemberExpr(MemberExpr *Node) {
1627 if (!Policy.SuppressImplicitBase || !isImplicitThis(Node->getBase())) {
1628 PrintExpr(Node->getBase());
1630 auto *ParentMember = dyn_cast<MemberExpr>(Node->getBase());
1636 OS << (Node->isArrow() ? "->" : ".");
1639 if (auto *FD = dyn_cast<FieldDecl>(Node->getMemberDecl()))
1643 if (NestedNameSpecifier *Qualifier = Node->getQualifier())
1645 if (Node->hasTemplateKeyword())
1647 OS << Node->getMemberNameInfo();
1649 if (auto *FD = dyn_cast<FunctionDecl>(Node->getMemberDecl())) {
1650 if (!Node->hadMultipleCandidates())
1654 dyn_cast<VarTemplateSpecializationDecl>(Node->getMemberDecl()))
1656 if (Node->hasExplicitTemplateArgs())
1657 printTemplateArgumentList(OS, Node->template_arguments(), Policy, TPL);
1660 void StmtPrinter::VisitObjCIsaExpr(ObjCIsaExpr *Node) {
1661 PrintExpr(Node->getBase());
1662 OS << (Node->isArrow() ? "->isa" : ".isa");
1665 void StmtPrinter::VisitExtVectorElementExpr(ExtVectorElementExpr *Node) {
1666 PrintExpr(Node->getBase());
1668 OS << Node->getAccessor().getName();
1671 void StmtPrinter::VisitCStyleCastExpr(CStyleCastExpr *Node) {
1673 Node->getTypeAsWritten().print(OS, Policy);
1675 PrintExpr(Node->getSubExpr());
1678 void StmtPrinter::VisitCompoundLiteralExpr(CompoundLiteralExpr *Node) {
1680 Node->getType().print(OS, Policy);
1682 PrintExpr(Node->getInitializer());
1685 void StmtPrinter::VisitImplicitCastExpr(ImplicitCastExpr *Node) {
1687 PrintExpr(Node->getSubExpr());
1690 void StmtPrinter::VisitBinaryOperator(BinaryOperator *Node) {
1691 PrintExpr(Node->getLHS());
1692 OS << " " << BinaryOperator::getOpcodeStr(Node->getOpcode()) << " ";
1693 PrintExpr(Node->getRHS());
1696 void StmtPrinter::VisitCompoundAssignOperator(CompoundAssignOperator *Node) {
1697 PrintExpr(Node->getLHS());
1698 OS << " " << BinaryOperator::getOpcodeStr(Node->getOpcode()) << " ";
1699 PrintExpr(Node->getRHS());
1702 void StmtPrinter::VisitConditionalOperator(ConditionalOperator *Node) {
1703 PrintExpr(Node->getCond());
1705 PrintExpr(Node->getLHS());
1707 PrintExpr(Node->getRHS());
1713 StmtPrinter::VisitBinaryConditionalOperator(BinaryConditionalOperator *Node) {
1714 PrintExpr(Node->getCommon());
1716 PrintExpr(Node->getFalseExpr());
1719 void StmtPrinter::VisitAddrLabelExpr(AddrLabelExpr *Node) {
1720 OS << "&&" << Node->getLabel()->getName();
1729 void StmtPrinter::VisitChooseExpr(ChooseExpr *Node) {
1731 PrintExpr(Node->getCond());
1733 PrintExpr(Node->getLHS());
1735 PrintExpr(Node->getRHS());
1743 void StmtPrinter::VisitShuffleVectorExpr(ShuffleVectorExpr *Node) {
1745 for (unsigned i = 0, e = Node->getNumSubExprs(); i != e; ++i) {
1747 PrintExpr(Node->getExpr(i));
1752 void StmtPrinter::VisitConvertVectorExpr(ConvertVectorExpr *Node) {
1754 PrintExpr(Node->getSrcExpr());
1756 Node->getType().print(OS, Policy);
1760 void StmtPrinter::VisitInitListExpr(InitListExpr* Node) {
1761 if (Node->getSyntacticForm()) {
1762 Visit(Node->getSyntacticForm());
1767 for (unsigned i = 0, e = Node->getNumInits(); i != e; ++i) {
1769 if (Node->getInit(i))
1770 PrintExpr(Node->getInit(i));
1777 void StmtPrinter::VisitArrayInitLoopExpr(ArrayInitLoopExpr *Node) {
1781 PrintExpr(Node->getSubExpr());
1785 void StmtPrinter::VisitArrayInitIndexExpr(ArrayInitIndexExpr *Node) {
1789 void StmtPrinter::VisitParenListExpr(ParenListExpr* Node) {
1791 for (unsigned i = 0, e = Node->getNumExprs(); i != e; ++i) {
1793 PrintExpr(Node->getExpr(i));
1798 void StmtPrinter::VisitDesignatedInitExpr(DesignatedInitExpr *Node) {
1800 for (const DesignatedInitExpr::Designator &D : Node->designators()) {
1813 PrintExpr(Node->getArrayIndex(D));
1815 PrintExpr(Node->getArrayRangeStart(D));
1817 PrintExpr(Node->getArrayRangeEnd(D));
1827 PrintExpr(Node->getInit());
1831 DesignatedInitUpdateExpr *Node) {
1834 PrintExpr(Node->getBase());
1838 PrintExpr(Node->getUpdater());
1842 void StmtPrinter::VisitNoInitExpr(NoInitExpr *Node) {
1846 void StmtPrinter::VisitImplicitValueInitExpr(ImplicitValueInitExpr *Node) {
1847 if (Node->getType()->getAsCXXRecordDecl()) {
1849 Node->getType().print(OS, Policy);
1853 Node->getType().print(OS, Policy);
1855 if (Node->getType()->isRecordType())
1862 void StmtPrinter::VisitVAArgExpr(VAArgExpr *Node) {
1864 PrintExpr(Node->getSubExpr());
1866 Node->getType().print(OS, Policy);
1870 void StmtPrinter::VisitPseudoObjectExpr(PseudoObjectExpr *Node) {
1871 PrintExpr(Node->getSyntacticForm());
1874 void StmtPrinter::VisitAtomicExpr(AtomicExpr *Node) {
1876 switch (Node->getOp()) {
1887 PrintExpr(Node->getPtr());
1888 if (Node->getOp() != AtomicExpr::AO__c11_atomic_load &&
1889 Node->getOp() != AtomicExpr::AO__atomic_load_n &&
1890 Node->getOp() != AtomicExpr::AO__scoped_atomic_load_n &&
1891 Node->getOp() != AtomicExpr::AO__opencl_atomic_load &&
1892 Node->getOp() != AtomicExpr::AO__hip_atomic_load) {
1894 PrintExpr(Node->getVal1());
1896 if (Node->getOp() == AtomicExpr::AO__atomic_exchange ||
1897 Node->isCmpXChg()) {
1899 PrintExpr(Node->getVal2());
1901 if (Node->getOp() == AtomicExpr::AO__atomic_compare_exchange ||
1902 Node->getOp() == AtomicExpr::AO__atomic_compare_exchange_n) {
1904 PrintExpr(Node->getWeak());
1906 if (Node->getOp() != AtomicExpr::AO__c11_atomic_init &&
1907 Node->getOp() != AtomicExpr::AO__opencl_atomic_init) {
1909 PrintExpr(Node->getOrder());
1911 if (Node->isCmpXChg()) {
1913 PrintExpr(Node->getOrderFail());
1919 void StmtPrinter::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *Node) {
1920 OverloadedOperatorKind Kind = Node->getOperator();
1922 if (Node->getNumArgs() == 1) {
1924 PrintExpr(Node->getArg(0));
1926 PrintExpr(Node->getArg(0));
1930 PrintExpr(Node->getArg(0));
1932 PrintExpr(Node->getArg(0));
1934 for (unsigned ArgIdx = 1; ArgIdx < Node->getNumArgs(); ++ArgIdx) {
1937 if (!isa<CXXDefaultArgExpr>(Node->getArg(ArgIdx)))
1938 PrintExpr(Node->getArg(ArgIdx));
1941 } else if (Node->getNumArgs() == 1) {
1943 PrintExpr(Node->getArg(0));
1944 } else if (Node->getNumArgs() == 2) {
1945 PrintExpr(Node->getArg(0));
1947 PrintExpr(Node->getArg(1));
1953 void StmtPrinter::VisitCXXMemberCallExpr(CXXMemberCallExpr *Node) {
1955 CXXMethodDecl *MD = Node->getMethodDecl();
1957 PrintExpr(Node->getImplicitObjectArgument());
1960 VisitCallExpr(cast<CallExpr>(Node));
1963 void StmtPrinter::VisitCUDAKernelCallExpr(CUDAKernelCallExpr *Node) {
1964 PrintExpr(Node->getCallee());
1966 PrintCallArgs(Node->getConfig());
1968 PrintCallArgs(Node);
1973 CXXRewrittenBinaryOperator *Node) {
1975 Node->getDecomposedForm();
1981 void StmtPrinter::VisitCXXNamedCastExpr(CXXNamedCastExpr *Node) {
1982 OS << Node->getCastName() << '<';
1983 Node->getTypeAsWritten().print(OS, Policy);
1985 PrintExpr(Node->getSubExpr());
1989 void StmtPrinter::VisitCXXStaticCastExpr(CXXStaticCastExpr *Node) {
1990 VisitCXXNamedCastExpr(Node);
1993 void StmtPrinter::VisitCXXDynamicCastExpr(CXXDynamicCastExpr *Node) {
1994 VisitCXXNamedCastExpr(Node);
1997 void StmtPrinter::VisitCXXReinterpretCastExpr(CXXReinterpretCastExpr *Node) {
1998 VisitCXXNamedCastExpr(Node);
2001 void StmtPrinter::VisitCXXConstCastExpr(CXXConstCastExpr *Node) {
2002 VisitCXXNamedCastExpr(Node);
2005 void StmtPrinter::VisitBuiltinBitCastExpr(BuiltinBitCastExpr *Node) {
2007 Node->getTypeInfoAsWritten()->getType().print(OS, Policy);
2009 PrintExpr(Node->getSubExpr());
2013 void StmtPrinter::VisitCXXAddrspaceCastExpr(CXXAddrspaceCastExpr *Node) {
2014 VisitCXXNamedCastExpr(Node);
2017 void StmtPrinter::VisitCXXTypeidExpr(CXXTypeidExpr *Node) {
2019 if (Node->isTypeOperand()) {
2020 Node->getTypeOperandSourceInfo()->getType().print(OS, Policy);
2022 PrintExpr(Node->getExprOperand());
2027 void StmtPrinter::VisitCXXUuidofExpr(CXXUuidofExpr *Node) {
2029 if (Node->isTypeOperand()) {
2030 Node->getTypeOperandSourceInfo()->getType().print(OS, Policy);
2032 PrintExpr(Node->getExprOperand());
2037 void StmtPrinter::VisitMSPropertyRefExpr(MSPropertyRefExpr *Node) {
2038 PrintExpr(Node->getBaseExpr());
2039 if (Node->isArrow())
2044 Node->getQualifierLoc().getNestedNameSpecifier())
2046 OS << Node->getPropertyDecl()->getDeclName();
2049 void StmtPrinter::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *Node) {
2050 PrintExpr(Node->getBase());
2052 PrintExpr(Node->getIdx());
2056 void StmtPrinter::VisitUserDefinedLiteral(UserDefinedLiteral *Node) {
2057 switch (Node->getLiteralOperatorKind()) {
2059 OS << cast<StringLiteral>(Node->getArg(0)->IgnoreImpCasts())->getString();
2062 const auto *DRE = cast<DeclRefExpr>(Node->getCallee()->IgnoreImpCasts());
2072 OS << "operator\"\"" << Node->getUDSuffix()->getName();
2087 const auto *Int = cast<IntegerLiteral>(Node->getCookedLiteral());
2093 auto *Float = cast<FloatingLiteral>(Node->getCookedLiteral());
2099 PrintExpr(Node->getCookedLiteral());
2102 OS << Node->getUDSuffix()->getName();
2105 void StmtPrinter::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *Node) {
2106 OS << (Node->getValue() ? "true" : "false");
2109 void StmtPrinter::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *Node) {
2113 void StmtPrinter::VisitCXXThisExpr(CXXThisExpr *Node) {
2117 void StmtPrinter::VisitCXXThrowExpr(CXXThrowExpr *Node) {
2118 if (!Node->getSubExpr())
2122 PrintExpr(Node->getSubExpr());
2126 void StmtPrinter::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *Node) {
2130 void StmtPrinter::VisitCXXDefaultInitExpr(CXXDefaultInitExpr *Node) {
2134 void StmtPrinter::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *Node) {
2135 auto TargetType = Node->getType();
2147 if (!Node->isListInitialization())
2149 PrintExpr(Node->getSubExpr());
2150 if (!Node->isListInitialization())
2154 void StmtPrinter::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *Node) {
2155 PrintExpr(Node->getSubExpr());
2158 void StmtPrinter::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *Node) {
2159 Node->getType().print(OS, Policy);
2160 if (Node->isStdInitListInitialization())
2162 else if (Node->isListInitialization())
2166 for (CXXTemporaryObjectExpr::arg_iterator Arg = Node->arg_begin(),
2167 ArgEnd = Node->arg_end();
2171 if (Arg != Node->arg_begin())
2175 if (Node->isStdInitListInitialization())
2177 else if (Node->isListInitialization())
2183 void StmtPrinter::VisitLambdaExpr(LambdaExpr *Node) {
2186 switch (Node->getCaptureDefault()) {
2200 for (LambdaExpr::capture_iterator C = Node->explicit_capture_begin(),
2201 CEnd = Node->explicit_capture_end();
2221 if (Node->getCaptureDefault() != LCD_ByRef || Node->isInitCapture(C))
2237 if (Node->isInitCapture(C)) {
2258 if (!Node->getExplicitTemplateParameters().empty()) {
2259 Node->getTemplateParameterList()->print(
2260 OS, Node->getLambdaClass()->getASTContext(),
2264 if (Node->hasExplicitParameters()) {
2266 CXXMethodDecl *Method = Node->getCallOperator();
2287 if (Node->isMutable())
2296 if (Node->hasExplicitResultType()) {
2307 PrintRawCompoundStmt(Node->getCompoundStmtBody());
2310 void StmtPrinter::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *Node) {
2311 if (TypeSourceInfo *TSInfo = Node->getTypeSourceInfo())
2314 Node->getType().print(OS, Policy);
2418 CXXUnresolvedConstructExpr *Node) {
2419 Node->getTypeAsWritten().print(OS, Policy);
2420 if (!Node->isListInitialization())
2422 for (auto Arg = Node->arg_begin(), ArgEnd = Node->arg_end(); Arg != ArgEnd;
2424 if (Arg != Node->arg_begin())
2428 if (!Node->isListInitialization())
2433 CXXDependentScopeMemberExpr *Node) {
2434 if (!Node->isImplicitAccess()) {
2435 PrintExpr(Node->getBase());
2436 OS << (Node->isArrow() ? "->" : ".");
2438 if (NestedNameSpecifier *Qualifier = Node->getQualifier())
2440 if (Node->hasTemplateKeyword())
2442 OS << Node->getMemberNameInfo();
2443 if (Node->hasExplicitTemplateArgs())
2444 printTemplateArgumentList(OS, Node->template_arguments(), Policy);
2447 void StmtPrinter::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *Node) {
2448 if (!Node->isImplicitAccess()) {
2449 PrintExpr(Node->getBase());
2450 OS << (Node->isArrow() ? "->" : ".");
2452 if (NestedNameSpecifier *Qualifier = Node->getQualifier())
2454 if (Node->hasTemplateKeyword())
2456 OS << Node->getMemberNameInfo();
2457 if (Node->hasExplicitTemplateArgs())
2458 printTemplateArgumentList(OS, Node->template_arguments(), Policy);
2503 SubstNonTypeTemplateParmPackExpr *Node) {
2504 OS << *Node->getParameterPack();
2508 SubstNonTypeTemplateParmExpr *Node) {
2509 Visit(Node->getReplacement());
2516 void StmtPrinter::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *Node){
2517 PrintExpr(Node->getSubExpr());
2534 void StmtPrinter::VisitCXXParenListInitExpr(CXXParenListInitExpr *Node) {
2536 llvm::interleaveComma(Node->getInitExprs(), OS,
2639 void StmtPrinter::VisitObjCStringLiteral(ObjCStringLiteral *Node) {
2641 VisitStringLiteral(Node->getString());
2676 void StmtPrinter::VisitObjCEncodeExpr(ObjCEncodeExpr *Node) {
2678 Node->getEncodedType().print(OS, Policy);
2682 void StmtPrinter::VisitObjCSelectorExpr(ObjCSelectorExpr *Node) {
2684 Node->getSelector().print(OS);
2688 void StmtPrinter::VisitObjCProtocolExpr(ObjCProtocolExpr *Node) {
2689 OS << "@protocol(" << *Node->getProtocol() << ')';
2730 void StmtPrinter::VisitObjCBoolLiteralExpr(ObjCBoolLiteralExpr *Node) {
2731 OS << (Node->getValue() ? "__objc_yes" : "__objc_no");
2747 void StmtPrinter::VisitBlockExpr(BlockExpr *Node) {
2748 BlockDecl *BD = Node->getBlockDecl();
2751 const FunctionType *AFT = Node->getFunctionType();
2774 void StmtPrinter::VisitOpaqueValueExpr(OpaqueValueExpr *Node) {
2775 PrintExpr(Node->getSourceExpr());
2778 void StmtPrinter::VisitTypoExpr(TypoExpr *Node) {
2783 void StmtPrinter::VisitRecoveryExpr(RecoveryExpr *Node) {
2786 for (Expr *E : Node->subExpressions()) {
2794 void StmtPrinter::VisitAsTypeExpr(AsTypeExpr *Node) {
2796 PrintExpr(Node->getSrcExpr());
2798 Node->getType().print(OS, Policy);