File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -148,13 +148,19 @@ void Value::destroyValueName() {
148
148
}
149
149
150
150
bool Value::hasNUses (unsigned N) const {
151
+ if (!UseList)
152
+ return N == 0 ;
153
+
151
154
// TODO: Disallow for ConstantData and remove !UseList check?
152
- return UseList && hasNItems (use_begin (), use_end (), N);
155
+ return hasNItems (use_begin (), use_end (), N);
153
156
}
154
157
155
158
bool Value::hasNUsesOrMore (unsigned N) const {
156
159
// TODO: Disallow for ConstantData and remove !UseList check?
157
- return UseList && hasNItemsOrMore (use_begin (), use_end (), N);
160
+ if (!UseList)
161
+ return N == 0 ;
162
+
163
+ return hasNItemsOrMore (use_begin (), use_end (), N);
158
164
}
159
165
160
166
bool Value::hasOneUser () const {
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ TEST(ConstantsTest, UseCounts) {
29
29
30
30
EXPECT_TRUE (Zero->use_empty ());
31
31
EXPECT_EQ (Zero->getNumUses (), 0u );
32
+ EXPECT_TRUE (Zero->hasNUses (0 ));
32
33
EXPECT_FALSE (Zero->hasOneUse ());
33
34
EXPECT_FALSE (Zero->hasOneUser ());
34
35
EXPECT_FALSE (Zero->hasNUses (1 ));
@@ -49,6 +50,7 @@ TEST(ConstantsTest, UseCounts) {
49
50
// Still looks like use_empty with uses.
50
51
EXPECT_TRUE (Zero->use_empty ());
51
52
EXPECT_EQ (Zero->getNumUses (), 0u );
53
+ EXPECT_TRUE (Zero->hasNUses (0 ));
52
54
EXPECT_FALSE (Zero->hasOneUse ());
53
55
EXPECT_FALSE (Zero->hasOneUser ());
54
56
EXPECT_FALSE (Zero->hasNUses (1 ));
You can’t perform that action at this time.
0 commit comments