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() {
148148}
149149
150150bool Value::hasNUses (unsigned N) const {
151+ if (!UseList)
152+ return N == 0 ;
153+
151154 // 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);
153156}
154157
155158bool Value::hasNUsesOrMore (unsigned N) const {
156159 // 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);
158164}
159165
160166bool Value::hasOneUser () const {
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ TEST(ConstantsTest, UseCounts) {
2929
3030 EXPECT_TRUE (Zero->use_empty ());
3131 EXPECT_EQ (Zero->getNumUses (), 0u );
32+ EXPECT_TRUE (Zero->hasNUses (0 ));
3233 EXPECT_FALSE (Zero->hasOneUse ());
3334 EXPECT_FALSE (Zero->hasOneUser ());
3435 EXPECT_FALSE (Zero->hasNUses (1 ));
@@ -49,6 +50,7 @@ TEST(ConstantsTest, UseCounts) {
4950 // Still looks like use_empty with uses.
5051 EXPECT_TRUE (Zero->use_empty ());
5152 EXPECT_EQ (Zero->getNumUses (), 0u );
53+ EXPECT_TRUE (Zero->hasNUses (0 ));
5254 EXPECT_FALSE (Zero->hasOneUse ());
5355 EXPECT_FALSE (Zero->hasOneUser ());
5456 EXPECT_FALSE (Zero->hasNUses (1 ));
You can’t perform that action at this time.
0 commit comments