Skip to content

Commit 3e11ae6

Browse files
committed
[ORC] Merge ostream operators for SymbolStringPtrs into SymbolStringPool.h. NFC.
These are simple and commonly used. Having them in the SymbolStringPool header saves clients from having to #include "DebugUtils.h" everywhere.
1 parent 442ee78 commit 3e11ae6

File tree

4 files changed

+8
-14
lines changed

4 files changed

+8
-14
lines changed

llvm/include/llvm/ExecutionEngine/Orc/DebugUtils.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,6 @@ namespace orc {
2929

3030
// --raw_ostream operators for ORC types--
3131

32-
/// Render a SymbolStringPtr.
33-
raw_ostream &operator<<(raw_ostream &OS, const SymbolStringPtr &Sym);
34-
35-
/// Render a NonOwningSymbolStringPtr.
36-
raw_ostream &operator<<(raw_ostream &OS, NonOwningSymbolStringPtr Sym);
37-
3832
/// Render a SymbolNameSet.
3933
raw_ostream &operator<<(raw_ostream &OS, const SymbolNameSet &Symbols);
4034

llvm/include/llvm/ExecutionEngine/Orc/SymbolStringPool.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ class SymbolStringPtrBase {
9292
return LHS.S < RHS.S;
9393
}
9494

95+
friend raw_ostream &operator<<(raw_ostream &OS,
96+
const SymbolStringPtrBase &Sym);
97+
9598
#ifndef NDEBUG
9699
// Returns true if the pool entry's ref count is above zero (or if the entry
97100
// is an empty or tombstone value). Useful for debugging and testing -- this

llvm/lib/ExecutionEngine/Orc/Core.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "llvm/ExecutionEngine/Orc/Shared/OrcError.h"
1515
#include "llvm/Support/FormatVariadic.h"
1616
#include "llvm/Support/MSVCErrorWorkarounds.h"
17+
#include "llvm/Support/raw_ostream.h"
1718

1819
#include <condition_variable>
1920
#include <future>
@@ -37,6 +38,10 @@ char LookupTask::ID = 0;
3738
RegisterDependenciesFunction NoDependenciesToRegister =
3839
RegisterDependenciesFunction();
3940

41+
raw_ostream &operator<<(raw_ostream &OS, const SymbolStringPtrBase &Sym) {
42+
return (OS << Sym.S->first());
43+
}
44+
4045
void MaterializationUnit::anchor() {}
4146

4247
ResourceTracker::ResourceTracker(JITDylibSP JD) {

llvm/lib/ExecutionEngine/Orc/DebugUtils.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,6 @@ struct PrintSymbolMapElemsMatchingCLOpts {
137137
namespace llvm {
138138
namespace orc {
139139

140-
raw_ostream &operator<<(raw_ostream &OS, const SymbolStringPtr &Sym) {
141-
return OS << *Sym;
142-
}
143-
144-
raw_ostream &operator<<(raw_ostream &OS, NonOwningSymbolStringPtr Sym) {
145-
return OS << *Sym;
146-
}
147-
148140
raw_ostream &operator<<(raw_ostream &OS, const SymbolNameSet &Symbols) {
149141
return OS << printSequence(Symbols, '{', '}', PrintAll<SymbolStringPtr>());
150142
}

0 commit comments

Comments
 (0)