@@ -52,57 +52,54 @@ class PtrUseVisitorBase {
52
52
// / analysis and whether the visit completed or aborted early.
53
53
class PtrInfo {
54
54
public:
55
- PtrInfo () : AbortedInfo(nullptr , false ), EscapedInfo(nullptr , false ) {}
56
-
57
55
// / Reset the pointer info, clearing all state.
58
56
void reset () {
59
- AbortedInfo.setPointer (nullptr );
60
- AbortedInfo.setInt (false );
61
- EscapedInfo.setPointer (nullptr );
62
- EscapedInfo.setInt (false );
57
+ AbortedInfo = nullptr ;
58
+ EscapedInfo = nullptr ;
63
59
}
64
60
65
61
// / Did we abort the visit early?
66
- bool isAborted () const { return AbortedInfo. getInt () ; }
62
+ bool isAborted () const { return AbortedInfo != nullptr ; }
67
63
68
64
// / Is the pointer escaped at some point?
69
- bool isEscaped () const { return EscapedInfo. getInt () ; }
65
+ bool isEscaped () const { return EscapedInfo != nullptr ; }
70
66
71
67
// / Get the instruction causing the visit to abort.
72
68
// / \returns a pointer to the instruction causing the abort if one is
73
69
// / available; otherwise returns null.
74
- Instruction *getAbortingInst () const { return AbortedInfo. getPointer () ; }
70
+ Instruction *getAbortingInst () const { return AbortedInfo; }
75
71
76
72
// / Get the instruction causing the pointer to escape.
77
73
// / \returns a pointer to the instruction which escapes the pointer if one
78
74
// / is available; otherwise returns null.
79
- Instruction *getEscapingInst () const { return EscapedInfo. getPointer () ; }
75
+ Instruction *getEscapingInst () const { return EscapedInfo; }
80
76
81
77
// / Mark the visit as aborted. Intended for use in a void return.
82
78
// / \param I The instruction which caused the visit to abort, if available.
83
- void setAborted (Instruction *I = nullptr ) {
84
- AbortedInfo. setInt ( true );
85
- AbortedInfo. setPointer (I) ;
79
+ void setAborted (Instruction *I) {
80
+ assert (I && " Expected a valid pointer in setAborted " );
81
+ AbortedInfo = I ;
86
82
}
87
83
88
84
// / Mark the pointer as escaped. Intended for use in a void return.
89
85
// / \param I The instruction which escapes the pointer, if available.
90
- void setEscaped (Instruction *I = nullptr ) {
91
- EscapedInfo. setInt ( true );
92
- EscapedInfo. setPointer (I) ;
86
+ void setEscaped (Instruction *I) {
87
+ assert (I && " Expected a valid pointer in setEscaped " );
88
+ EscapedInfo = I ;
93
89
}
94
90
95
91
// / Mark the pointer as escaped, and the visit as aborted. Intended
96
92
// / for use in a void return.
97
93
// / \param I The instruction which both escapes the pointer and aborts the
98
94
// / visit, if available.
99
- void setEscapedAndAborted (Instruction *I = nullptr ) {
95
+ void setEscapedAndAborted (Instruction *I) {
100
96
setEscaped (I);
101
97
setAborted (I);
102
98
}
103
99
104
100
private:
105
- PointerIntPair<Instruction *, 1 , bool > AbortedInfo, EscapedInfo;
101
+ Instruction *AbortedInfo = nullptr ;
102
+ Instruction *EscapedInfo = nullptr ;
106
103
};
107
104
108
105
protected:
0 commit comments