@@ -2962,183 +2962,6 @@ struct DOTGraphTraits<ExplodedGraph*> : public DefaultDOTGraphTraits {
2962
2962
return {};
2963
2963
}
2964
2964
2965
- // De-duplicate some source location pretty-printing.
2966
- static void printLocation (raw_ostream &Out,
2967
- SourceLocation SLoc,
2968
- const SourceManager &SM,
2969
- StringRef Postfix=" \\ l" ) {
2970
- if (SLoc.isFileID ()) {
2971
- Out << " \\ lline="
2972
- << SM.getExpansionLineNumber (SLoc)
2973
- << " col="
2974
- << SM.getExpansionColumnNumber (SLoc)
2975
- << Postfix;
2976
- }
2977
- }
2978
-
2979
- static void dumpProgramPoint (ProgramPoint Loc,
2980
- const ASTContext &Context,
2981
- llvm::raw_string_ostream &Out) {
2982
- const SourceManager &SM = Context.getSourceManager ();
2983
- switch (Loc.getKind ()) {
2984
- case ProgramPoint::BlockEntranceKind:
2985
- Out << " Block Entrance: B"
2986
- << Loc.castAs <BlockEntrance>().getBlock ()->getBlockID ();
2987
- break ;
2988
-
2989
- case ProgramPoint::FunctionExitKind: {
2990
- auto FEP = Loc.getAs <FunctionExitPoint>();
2991
- Out << " Function Exit: B"
2992
- << FEP->getBlock ()->getBlockID ();
2993
- if (const ReturnStmt *RS = FEP->getStmt ()) {
2994
- Out << " \\ l Return: S" << RS->getID (Context) << " \\ l" ;
2995
- RS->printPretty (Out, /* helper=*/ nullptr , Context.getPrintingPolicy (),
2996
- /* Indentation=*/ 2 , /* NewlineSymbol=*/ " \\ l" );
2997
- }
2998
- break ;
2999
- }
3000
- case ProgramPoint::BlockExitKind:
3001
- assert (false );
3002
- break ;
3003
-
3004
- case ProgramPoint::CallEnterKind:
3005
- Out << " CallEnter" ;
3006
- break ;
3007
-
3008
- case ProgramPoint::CallExitBeginKind:
3009
- Out << " CallExitBegin" ;
3010
- break ;
3011
-
3012
- case ProgramPoint::CallExitEndKind:
3013
- Out << " CallExitEnd" ;
3014
- break ;
3015
-
3016
- case ProgramPoint::PostStmtPurgeDeadSymbolsKind:
3017
- Out << " PostStmtPurgeDeadSymbols" ;
3018
- break ;
3019
-
3020
- case ProgramPoint::PreStmtPurgeDeadSymbolsKind:
3021
- Out << " PreStmtPurgeDeadSymbols" ;
3022
- break ;
3023
-
3024
- case ProgramPoint::EpsilonKind:
3025
- Out << " Epsilon Point" ;
3026
- break ;
3027
-
3028
- case ProgramPoint::LoopExitKind: {
3029
- LoopExit LE = Loc.castAs <LoopExit>();
3030
- Out << " LoopExit: " << LE.getLoopStmt ()->getStmtClassName ();
3031
- break ;
3032
- }
3033
-
3034
- case ProgramPoint::PreImplicitCallKind: {
3035
- ImplicitCallPoint PC = Loc.castAs <ImplicitCallPoint>();
3036
- Out << " PreCall: " ;
3037
- PC.getDecl ()->print (Out, Context.getLangOpts ());
3038
- printLocation (Out, PC.getLocation (), SM);
3039
- break ;
3040
- }
3041
-
3042
- case ProgramPoint::PostImplicitCallKind: {
3043
- ImplicitCallPoint PC = Loc.castAs <ImplicitCallPoint>();
3044
- Out << " PostCall: " ;
3045
- PC.getDecl ()->print (Out, Context.getLangOpts ());
3046
- printLocation (Out, PC.getLocation (), SM);
3047
- break ;
3048
- }
3049
-
3050
- case ProgramPoint::PostInitializerKind: {
3051
- Out << " PostInitializer: " ;
3052
- const CXXCtorInitializer *Init =
3053
- Loc.castAs <PostInitializer>().getInitializer ();
3054
- if (const FieldDecl *FD = Init->getAnyMember ())
3055
- Out << *FD;
3056
- else {
3057
- QualType Ty = Init->getTypeSourceInfo ()->getType ();
3058
- Ty = Ty.getLocalUnqualifiedType ();
3059
- Ty.print (Out, Context.getLangOpts ());
3060
- }
3061
- break ;
3062
- }
3063
-
3064
- case ProgramPoint::BlockEdgeKind: {
3065
- const BlockEdge &E = Loc.castAs <BlockEdge>();
3066
- Out << " Edge: (B" << E.getSrc ()->getBlockID () << " , B"
3067
- << E.getDst ()->getBlockID () << ' )' ;
3068
-
3069
- if (const Stmt *T = E.getSrc ()->getTerminator ()) {
3070
- SourceLocation SLoc = T->getBeginLoc ();
3071
-
3072
- Out << " \\ |Terminator: " ;
3073
- E.getSrc ()->printTerminator (Out, Context.getLangOpts ());
3074
- printLocation (Out, SLoc, SM, /* Postfix=*/ " " );
3075
-
3076
- if (isa<SwitchStmt>(T)) {
3077
- const Stmt *Label = E.getDst ()->getLabel ();
3078
-
3079
- if (Label) {
3080
- if (const auto *C = dyn_cast<CaseStmt>(Label)) {
3081
- Out << " \\ lcase " ;
3082
- if (C->getLHS ())
3083
- C->getLHS ()->printPretty (
3084
- Out, nullptr , Context.getPrintingPolicy (),
3085
- /* Indentation=*/ 0 , /* NewlineSymbol=*/ " \\ l" );
3086
-
3087
- if (const Stmt *RHS = C->getRHS ()) {
3088
- Out << " .. " ;
3089
- RHS->printPretty (Out, nullptr , Context.getPrintingPolicy (),
3090
- /* Indetation=*/ 0 , /* NewlineSymbol=*/ " \\ l" );
3091
- }
3092
-
3093
- Out << " :" ;
3094
- } else {
3095
- assert (isa<DefaultStmt>(Label));
3096
- Out << " \\ ldefault:" ;
3097
- }
3098
- } else
3099
- Out << " \\ l(implicit) default:" ;
3100
- } else if (isa<IndirectGotoStmt>(T)) {
3101
- // FIXME
3102
- } else {
3103
- Out << " \\ lCondition: " ;
3104
- if (*E.getSrc ()->succ_begin () == E.getDst ())
3105
- Out << " true" ;
3106
- else
3107
- Out << " false" ;
3108
- }
3109
-
3110
- Out << " \\ l" ;
3111
- }
3112
-
3113
- break ;
3114
- }
3115
-
3116
- default : {
3117
- const Stmt *S = Loc.castAs <StmtPoint>().getStmt ();
3118
- assert (S != nullptr && " Expecting non-null Stmt" );
3119
-
3120
- Out << S->getStmtClassName () << " S"
3121
- << S->getID (Context) << " <" << (const void *)S << " > " ;
3122
- S->printPretty (Out, /* helper=*/ nullptr , Context.getPrintingPolicy (),
3123
- /* Indentation=*/ 2 , /* NewlineSymbol=*/ " \\ l" );
3124
- printLocation (Out, S->getBeginLoc (), SM, /* Postfix=*/ " " );
3125
-
3126
- if (Loc.getAs <PreStmt>())
3127
- Out << " \\ lPreStmt\\ l" ;
3128
- else if (Loc.getAs <PostLoad>())
3129
- Out << " \\ lPostLoad\\ l" ;
3130
- else if (Loc.getAs <PostStore>())
3131
- Out << " \\ lPostStore\\ l" ;
3132
- else if (Loc.getAs <PostLValue>())
3133
- Out << " \\ lPostLValue\\ l" ;
3134
- else if (Loc.getAs <PostAllocatorCall>())
3135
- Out << " \\ lPostAllocatorCall\\ l" ;
3136
-
3137
- break ;
3138
- }
3139
- }
3140
- }
3141
-
3142
2965
static bool isNodeHidden (const ExplodedNode *N) {
3143
2966
return N->isTrivial ();
3144
2967
}
@@ -3156,12 +2979,11 @@ struct DOTGraphTraits<ExplodedGraph*> : public DefaultDOTGraphTraits {
3156
2979
}
3157
2980
3158
2981
ProgramStateRef State = N->getState ();
3159
- const ASTContext &Context = State->getStateManager ().getContext ();
3160
2982
3161
2983
// Dump program point for all the previously skipped nodes.
3162
2984
const ExplodedNode *OtherNode = FirstHiddenNode;
3163
2985
while (true ) {
3164
- dumpProgramPoint ( OtherNode->getLocation (), Context , Out);
2986
+ OtherNode->getLocation (). print ( /* CR= */ " \\ l " , Out);
3165
2987
3166
2988
if (const ProgramPointTag *Tag = OtherNode->getLocation ().getTag ())
3167
2989
Out << " \\ lTag:" << Tag->getTagDescription ();
0 commit comments