Skip to content

Commit f8c5541

Browse files
committed
[NFC][ObjectSize] Make method public
Windows barfs on the 'friend class SizeOffsetType;' statement. Attempt to fix by making the method called by the "friend" class public.
1 parent 4ca1b5e commit f8c5541

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

llvm/include/llvm/Analysis/MemoryBuiltins.h

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ Value *lowerObjectSizeCall(
190190
/// SizeOffsetType - A base template class for the object size visitors. Used
191191
/// here as a self-documenting way to handle the values rather than using a
192192
/// \p std::pair.
193-
template <typename T, class C> class SizeOffsetType {
193+
template <typename T, class C> struct SizeOffsetType {
194194
public:
195195
T Size;
196196
T Offset;
@@ -213,13 +213,11 @@ template <typename T, class C> class SizeOffsetType {
213213

214214
/// SizeOffsetAPInt - Used by \p ObjectSizeOffsetVisitor, which works with
215215
/// \p APInts.
216-
class SizeOffsetAPInt : public SizeOffsetType<APInt, SizeOffsetAPInt> {
217-
friend class SizeOffsetType;
218-
static bool known(APInt V) { return V.getBitWidth() > 1; }
219-
220-
public:
216+
struct SizeOffsetAPInt : public SizeOffsetType<APInt, SizeOffsetAPInt> {
221217
SizeOffsetAPInt() = default;
222218
SizeOffsetAPInt(APInt Size, APInt Offset) : SizeOffsetType(Size, Offset) {}
219+
220+
static bool known(APInt V) { return V.getBitWidth() > 1; }
223221
};
224222

225223
/// Evaluate the size and offset of an object pointed to by a Value*
@@ -274,30 +272,26 @@ class ObjectSizeOffsetVisitor
274272

275273
/// SizeOffsetValue - Used by \p ObjectSizeOffsetEvaluator, which works with
276274
/// \p Values.
277-
class SizeOffsetWeakTrackingVH;
278-
class SizeOffsetValue : public SizeOffsetType<Value *, SizeOffsetValue> {
279-
friend class SizeOffsetType;
280-
static bool known(Value *V) { return V != nullptr; }
281-
282-
public:
275+
struct SizeOffsetWeakTrackingVH;
276+
struct SizeOffsetValue : public SizeOffsetType<Value *, SizeOffsetValue> {
283277
SizeOffsetValue() : SizeOffsetType(nullptr, nullptr) {}
284278
SizeOffsetValue(Value *Size, Value *Offset) : SizeOffsetType(Size, Offset) {}
285279
SizeOffsetValue(const SizeOffsetWeakTrackingVH &SOT);
280+
281+
static bool known(Value *V) { return V != nullptr; }
286282
};
287283

288284
/// SizeOffsetWeakTrackingVH - Used by \p ObjectSizeOffsetEvaluator in a
289285
/// \p DenseMap.
290-
class SizeOffsetWeakTrackingVH
286+
struct SizeOffsetWeakTrackingVH
291287
: public SizeOffsetType<WeakTrackingVH, SizeOffsetWeakTrackingVH> {
292-
friend class SizeOffsetType;
293-
static bool known(WeakTrackingVH V) { return V.pointsToAliveValue(); }
294-
295-
public:
296288
SizeOffsetWeakTrackingVH() : SizeOffsetType(nullptr, nullptr) {}
297289
SizeOffsetWeakTrackingVH(Value *Size, Value *Offset)
298290
: SizeOffsetType(Size, Offset) {}
299291
SizeOffsetWeakTrackingVH(const SizeOffsetValue &SOV)
300292
: SizeOffsetType(SOV.Size, SOV.Offset) {}
293+
294+
static bool known(WeakTrackingVH V) { return V.pointsToAliveValue(); }
301295
};
302296

303297
/// Evaluate the size and offset of an object pointed to by a Value*.

0 commit comments

Comments
 (0)