Skip to content

Commit 9a0e1c7

Browse files
authored
Revert "[llvm] properly guard dump methods in Support lib classes" (#139927)
Reverts #139804
1 parent ba23eed commit 9a0e1c7

21 files changed

+22
-86
lines changed

llvm/include/llvm/ADT/APFixedPoint.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,7 @@ class APFixedPoint {
249249
}
250250

251251
void print(raw_ostream &) const;
252-
253-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
254-
LLVM_DUMP_METHOD void dump() const;
255-
#endif
252+
void dump() const;
256253

257254
// If LHS > RHS, return 1. If LHS == RHS, return 0. If LHS < RHS, return -1.
258255
int compare(const APFixedPoint &Other) const;

llvm/include/llvm/ADT/APFloat.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,10 +1483,7 @@ class APFloat : public APFloatBase {
14831483
}
14841484

14851485
void print(raw_ostream &) const;
1486-
1487-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
1488-
LLVM_DUMP_METHOD void dump() const;
1489-
#endif
1486+
void dump() const;
14901487

14911488
bool getExactInverse(APFloat *inv) const {
14921489
APFLOAT_DISPATCH_ON_SEMANTICS(getExactInverse(inv));

llvm/include/llvm/ADT/APInt.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1896,10 +1896,8 @@ class [[nodiscard]] APInt {
18961896
/// FoldingSets.
18971897
void Profile(FoldingSetNodeID &id) const;
18981898

1899-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
19001899
/// debug method
1901-
LLVM_DUMP_METHOD void dump() const;
1902-
#endif
1900+
void dump() const;
19031901

19041902
/// Returns whether this instance allocated memory.
19051903
bool needsCleanup() const { return !isSingleWord(); }

llvm/include/llvm/ADT/DynamicAPInt.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,7 @@ class DynamicAPInt {
216216
void static_assert_layout(); // NOLINT
217217

218218
raw_ostream &print(raw_ostream &OS) const;
219-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
220219
LLVM_DUMP_METHOD void dump() const;
221-
#endif
222220
};
223221

224222
inline raw_ostream &operator<<(raw_ostream &OS, const DynamicAPInt &X) {

llvm/include/llvm/ADT/SlowDynamicAPInt.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,7 @@ class SlowDynamicAPInt {
7979
unsigned getBitWidth() const { return Val.getBitWidth(); }
8080

8181
void print(raw_ostream &OS) const;
82-
83-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
8482
LLVM_DUMP_METHOD void dump() const;
85-
#endif
8683
};
8784

8885
inline raw_ostream &operator<<(raw_ostream &OS, const SlowDynamicAPInt &X) {

llvm/include/llvm/ADT/TrieRawHashMap.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,7 @@ class ThreadSafeTrieRawHashMapBase {
9090
static void *operator new(size_t Size) { return ::operator new(Size); }
9191
void operator delete(void *Ptr) { ::operator delete(Ptr); }
9292

93-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
9493
LLVM_DUMP_METHOD void dump() const;
95-
#endif
96-
9794
void print(raw_ostream &OS) const;
9895

9996
protected:
@@ -217,10 +214,7 @@ class ThreadSafeTrieRawHashMap : public ThreadSafeTrieRawHashMapBase {
217214
using ThreadSafeTrieRawHashMapBase::operator delete;
218215
using HashType = HashT;
219216

220-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
221217
using ThreadSafeTrieRawHashMapBase::dump;
222-
#endif
223-
224218
using ThreadSafeTrieRawHashMapBase::print;
225219

226220
private:

llvm/include/llvm/ADT/Twine.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -507,16 +507,14 @@ namespace llvm {
507507
/// stream \p OS.
508508
void print(raw_ostream &OS) const;
509509

510+
/// Dump the concatenated string represented by this twine to stderr.
511+
void dump() const;
512+
510513
/// Write the representation of this twine to the stream \p OS.
511514
void printRepr(raw_ostream &OS) const;
512515

513-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
514-
/// Dump the concatenated string represented by this twine to stderr.
515-
LLVM_DUMP_METHOD void dump() const;
516-
517516
/// Dump the representation of this twine to stderr.
518-
LLVM_DUMP_METHOD void dumpRepr() const;
519-
#endif
517+
void dumpRepr() const;
520518

521519
/// @}
522520
};

llvm/include/llvm/Support/BalancedPartitioning.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,7 @@ class BPFunctionNode {
6868
/// The ID of this node
6969
IDT Id;
7070

71-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
72-
LLVM_DUMP_METHOD void dump(raw_ostream &OS) const;
73-
#endif
71+
LLVM_ABI void dump(raw_ostream &OS) const;
7472

7573
protected:
7674
/// The list of utility nodes associated with this node

llvm/include/llvm/Support/BranchProbability.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,7 @@ class BranchProbability {
7777

7878
LLVM_ABI raw_ostream &print(raw_ostream &OS) const;
7979

80-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
81-
LLVM_DUMP_METHOD void dump() const;
82-
#endif
80+
LLVM_ABI void dump() const;
8381

8482
/// Scale a large integer.
8583
///

llvm/include/llvm/Support/DebugCounter.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,8 @@ class DebugCounter {
119119
Counter.CurrChunkIdx = State.ChunkIdx;
120120
}
121121

122-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
123122
// Dump or print the current counter set into llvm::dbgs().
124-
LLVM_DUMP_METHOD void dump() const;
125-
#endif
123+
LLVM_ABI LLVM_DUMP_METHOD void dump() const;
126124

127125
LLVM_ABI void print(raw_ostream &OS) const;
128126

llvm/include/llvm/Support/KnownBits.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -513,10 +513,7 @@ struct KnownBits {
513513
bool operator!=(const KnownBits &Other) const { return !(*this == Other); }
514514

515515
LLVM_ABI void print(raw_ostream &OS) const;
516-
517-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
518-
LLVM_DUMP_METHOD void dump() const;
519-
#endif
516+
LLVM_ABI void dump() const;
520517

521518
private:
522519
// Internal helper for getting the initial KnownBits for an `srem` or `urem`

llvm/include/llvm/Support/SMTAPI.h

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,7 @@ class SMTSort {
7171

7272
virtual void print(raw_ostream &OS) const = 0;
7373

74-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
75-
LLVM_DUMP_METHOD void dump() const;
76-
#endif
74+
LLVM_ABI LLVM_DUMP_METHOD void dump() const;
7775

7876
protected:
7977
/// Query the SMT solver and returns true if two sorts are equal (same kind
@@ -120,9 +118,7 @@ class SMTExpr {
120118

121119
virtual void print(raw_ostream &OS) const = 0;
122120

123-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
124-
LLVM_DUMP_METHOD void dump() const;
125-
#endif
121+
LLVM_ABI LLVM_DUMP_METHOD void dump() const;
126122

127123
protected:
128124
/// Query the SMT solver and returns true if two sorts are equal (same kind
@@ -140,9 +136,7 @@ class SMTSolverStatistics {
140136

141137
virtual void print(raw_ostream &OS) const = 0;
142138

143-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
144-
LLVM_DUMP_METHOD void dump() const;
145-
#endif
139+
LLVM_ABI LLVM_DUMP_METHOD void dump() const;
146140
};
147141

148142
/// Shared pointer for SMTExprs, used by SMTSolver API.
@@ -158,9 +152,7 @@ class SMTSolver {
158152
SMTSolver() = default;
159153
virtual ~SMTSolver() = default;
160154

161-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
162-
LLVM_DUMP_METHOD void dump() const;
163-
#endif
155+
LLVM_ABI LLVM_DUMP_METHOD void dump() const;
164156

165157
// Returns an appropriate floating-point sort for the given bitwidth.
166158
SMTSortRef getFloatSort(unsigned BitWidth) {

llvm/include/llvm/Support/ScaledNumber.h

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -424,10 +424,7 @@ class ScaledNumberBase {
424424
public:
425425
static constexpr int DefaultPrecision = 10;
426426

427-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
428-
LLVM_DUMP_METHOD static void dump(uint64_t D, int16_t E, int Width);
429-
#endif
430-
427+
LLVM_ABI static void dump(uint64_t D, int16_t E, int Width);
431428
LLVM_ABI static raw_ostream &print(raw_ostream &OS, uint64_t D, int16_t E,
432429
int Width, unsigned Precision);
433430
LLVM_ABI static std::string toString(uint64_t D, int16_t E, int Width,
@@ -610,12 +607,7 @@ template <class DigitsT> class ScaledNumber : ScaledNumberBase {
610607
unsigned Precision = DefaultPrecision) const {
611608
return ScaledNumberBase::print(OS, Digits, Scale, Width, Precision);
612609
}
613-
614-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
615-
LLVM_DUMP_METHOD void dump() const {
616-
return ScaledNumberBase::dump(Digits, Scale, Width);
617-
}
618-
#endif
610+
void dump() const { return ScaledNumberBase::dump(Digits, Scale, Width); }
619611

620612
ScaledNumber &operator+=(const ScaledNumber &X) {
621613
std::tie(Digits, Scale) =

llvm/lib/Support/APFixedPoint.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -439,10 +439,7 @@ void APFixedPoint::print(raw_ostream &OS) const {
439439
Sema.print(OS);
440440
OS << "})";
441441
}
442-
443-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
444442
LLVM_DUMP_METHOD void APFixedPoint::dump() const { print(llvm::errs()); }
445-
#endif
446443

447444
APFixedPoint APFixedPoint::negate(bool *Overflow) const {
448445
if (!isSaturated()) {

llvm/lib/Support/BalancedPartitioning.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,10 @@
2121
using namespace llvm;
2222
#define DEBUG_TYPE "balanced-partitioning"
2323

24-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
25-
LLVM_DUMP_METHOD void BPFunctionNode::dump(raw_ostream &OS) const {
24+
void BPFunctionNode::dump(raw_ostream &OS) const {
2625
OS << formatv("{{ID={0} Utilities={{{1:$[,]}} Bucket={2}}", Id,
2726
make_range(UtilityNodes.begin(), UtilityNodes.end()), Bucket);
2827
}
29-
#endif
3028

3129
template <typename Func>
3230
void BalancedPartitioning::BPThreadPool::async(Func &&F) {

llvm/lib/Support/DebugCounter.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,6 @@ bool DebugCounter::shouldExecuteImpl(unsigned CounterName) {
248248
return true;
249249
}
250250

251-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
252251
LLVM_DUMP_METHOD void DebugCounter::dump() const {
253252
print(dbgs());
254253
}
255-
#endif

llvm/lib/Support/DynamicAPInt.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,4 @@ raw_ostream &DynamicAPInt::print(raw_ostream &OS) const {
3232
return OS << ValLarge;
3333
}
3434

35-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
36-
LLVM_DUMP_METHOD void DynamicAPInt::dump() const { print(dbgs()); }
37-
#endif
35+
void DynamicAPInt::dump() const { print(dbgs()); }

llvm/lib/Support/KnownBits.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,10 +1152,7 @@ void KnownBits::print(raw_ostream &OS) const {
11521152
OS << "?";
11531153
}
11541154
}
1155-
1156-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
1157-
LLVM_DUMP_METHOD void KnownBits::dump() const {
1155+
void KnownBits::dump() const {
11581156
print(dbgs());
11591157
dbgs() << "\n";
11601158
}
1161-
#endif

llvm/lib/Support/ScaledNumber.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,7 @@ raw_ostream &ScaledNumberBase::print(raw_ostream &OS, uint64_t D, int16_t E,
317317
return OS << toString(D, E, Width, Precision);
318318
}
319319

320-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
321-
LLVM_DUMP_METHOD void ScaledNumberBase::dump(uint64_t D, int16_t E, int Width) {
320+
void ScaledNumberBase::dump(uint64_t D, int16_t E, int Width) {
322321
print(dbgs(), D, E, Width, 0) << "[" << Width << ":" << D << "*2^" << E
323322
<< "]";
324323
}
325-
#endif

llvm/lib/Support/SlowDynamicAPInt.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,4 @@ SlowDynamicAPInt &SlowDynamicAPInt::operator--() {
283283
/// ---------------------------------------------------------------------------
284284
void SlowDynamicAPInt::print(raw_ostream &OS) const { OS << Val; }
285285

286-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
287-
LLVM_DUMP_METHOD void SlowDynamicAPInt::dump() const { print(dbgs()); }
288-
#endif
286+
void SlowDynamicAPInt::dump() const { print(dbgs()); }

llvm/lib/Support/Z3Solver.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -989,9 +989,7 @@ llvm::SMTSolverRef llvm::CreateZ3Solver() {
989989
#endif
990990
}
991991

992-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
993992
LLVM_DUMP_METHOD void SMTSort::dump() const { print(llvm::errs()); }
994993
LLVM_DUMP_METHOD void SMTExpr::dump() const { print(llvm::errs()); }
995994
LLVM_DUMP_METHOD void SMTSolver::dump() const { print(llvm::errs()); }
996995
LLVM_DUMP_METHOD void SMTSolverStatistics::dump() const { print(llvm::errs()); }
997-
#endif

0 commit comments

Comments
 (0)