Skip to content

[Support] Ensure complete type DelimitedScope #127459

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 21, 2025

Conversation

hahnjo
Copy link
Member

@hahnjo hahnjo commented Feb 17, 2025

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.

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.
@llvmbot
Copy link
Member

llvmbot commented Feb 17, 2025

@llvm/pr-subscribers-llvm-support

Author: Jonas Hahnfeld (hahnjo)

Changes

JSONScopedPrinter has a std::unique_ptr&lt;DelimitedScope&gt; member and defaulted constructor argument, so it needs a complete type. This resolves one of the many build errors with C++23 using Clang.


Full diff: https://github.com/llvm/llvm-project/pull/127459.diff

1 Files Affected:

  • (modified) llvm/include/llvm/Support/ScopedPrinter.h (+7-9)
diff --git a/llvm/include/llvm/Support/ScopedPrinter.h b/llvm/include/llvm/Support/ScopedPrinter.h
index 419ab97366796..506b40a09ed78 100644
--- a/llvm/include/llvm/Support/ScopedPrinter.h
+++ b/llvm/include/llvm/Support/ScopedPrinter.h
@@ -539,7 +539,13 @@ ScopedPrinter::printHex<support::ulittle16_t>(StringRef Label,
   startLine() << Label << ": " << hex(Value) << "\n";
 }
 
-struct DelimitedScope;
+struct DelimitedScope {
+  DelimitedScope(ScopedPrinter &W) : W(&W) {}
+  DelimitedScope() : W(nullptr) {}
+  virtual ~DelimitedScope() = default;
+  virtual void setPrinter(ScopedPrinter &W) = 0;
+  ScopedPrinter *W;
+};
 
 class JSONScopedPrinter : public ScopedPrinter {
 private:
@@ -838,14 +844,6 @@ class JSONScopedPrinter : public ScopedPrinter {
   }
 };
 
-struct DelimitedScope {
-  DelimitedScope(ScopedPrinter &W) : W(&W) {}
-  DelimitedScope() : W(nullptr) {}
-  virtual ~DelimitedScope() = default;
-  virtual void setPrinter(ScopedPrinter &W) = 0;
-  ScopedPrinter *W;
-};
-
 struct DictScope : DelimitedScope {
   explicit DictScope() = default;
   explicit DictScope(ScopedPrinter &W) : DelimitedScope(W) { W.objectBegin(); }

hahnjo added a commit to hahnjo/root that referenced this pull request Feb 17, 2025
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.

Backport of llvm/llvm-project#127459
TODO: needs a tag
@dwblaikie dwblaikie merged commit e65d388 into llvm:main Feb 21, 2025
10 checks passed
@hahnjo hahnjo deleted the move-DelimitedScope branch February 22, 2025 09:39
@hahnjo
Copy link
Member Author

hahnjo commented Feb 22, 2025

Thanks @dwblaikie for merging. In the future, I would prefer to merge PRs myself though because now the commit in the repository has the wrong email address (my work one, not my private dev address as I contributed this outside work time). I was very surprised this morning to have 60+ emails in my work inbox from buildbots (not this change though)...

@dwblaikie
Copy link
Collaborator

Thanks @dwblaikie for merging. In the future, I would prefer to merge PRs myself though because now the commit in the repository has the wrong email address (my work one, not my private dev address as I contributed this outside work time). I was very surprised this morning to have 60+ emails in my work inbox from buildbots (not this change though)...

Ah, sure thing - I'll try to keep that in mind.

@hahnjo
Copy link
Member Author

hahnjo commented Feb 25, 2025

/cherry-pick e65d388

@hahnjo hahnjo added this to the LLVM 20.X Release milestone Feb 25, 2025
@llvmbot
Copy link
Member

llvmbot commented Feb 25, 2025

/pull-request #128686

swift-ci pushed a commit to swiftlang/llvm-project that referenced this pull request Feb 25, 2025
`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.

(cherry picked from commit e65d388)
hahnjo added a commit to hahnjo/root that referenced this pull request Mar 13, 2025
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.

Backport of llvm/llvm-project#127459
hahnjo added a commit to hahnjo/root that referenced this pull request Mar 22, 2025
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.

Backport of llvm/llvm-project#127459
hahnjo added a commit to root-project/root that referenced this pull request Mar 23, 2025
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.

Backport of llvm/llvm-project#127459
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

3 participants