Skip to content

Commit e65d388

Browse files
authored
[Support] Ensure complete type DelimitedScope (#127459)
`JSONScopedPrinter` has a `std::unique_ptr<DelimitedScope>` member and defaulted constructor argument, so it needs a complete type. This resolves one of the many build errors with C++23 using Clang.
1 parent b0f0ac3 commit e65d388

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

llvm/include/llvm/Support/ScopedPrinter.h

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,13 @@ ScopedPrinter::printHex<support::ulittle16_t>(StringRef Label,
539539
startLine() << Label << ": " << hex(Value) << "\n";
540540
}
541541

542-
struct DelimitedScope;
542+
struct DelimitedScope {
543+
DelimitedScope(ScopedPrinter &W) : W(&W) {}
544+
DelimitedScope() : W(nullptr) {}
545+
virtual ~DelimitedScope() = default;
546+
virtual void setPrinter(ScopedPrinter &W) = 0;
547+
ScopedPrinter *W;
548+
};
543549

544550
class JSONScopedPrinter : public ScopedPrinter {
545551
private:
@@ -838,14 +844,6 @@ class JSONScopedPrinter : public ScopedPrinter {
838844
}
839845
};
840846

841-
struct DelimitedScope {
842-
DelimitedScope(ScopedPrinter &W) : W(&W) {}
843-
DelimitedScope() : W(nullptr) {}
844-
virtual ~DelimitedScope() = default;
845-
virtual void setPrinter(ScopedPrinter &W) = 0;
846-
ScopedPrinter *W;
847-
};
848-
849847
struct DictScope : DelimitedScope {
850848
explicit DictScope() = default;
851849
explicit DictScope(ScopedPrinter &W) : DelimitedScope(W) { W.objectBegin(); }

0 commit comments

Comments
 (0)