Skip to content

Conversation

@slydiman
Copy link
Contributor

If the includes tree is big enough, llvm::itanium_demangle::PointerType may conflict with llvm::PointerType from other headers. This patch fixes the following error:

C:\lldb-aarch64-windows\llvm-project\llvm\include\llvm/Demangle/ItaniumDemangle.h(617,16): warning: unqualified friend declaration referring to type outside of the nearest enclosing namespace is a Microsoft extension; add a nested name specifier [-Wmicrosoft-unqualified-friend]
  617 |   friend class PointerType;
      |                ^
      |                ::llvm::
C:\lldb-aarch64-windows\llvm-project\llvm\include\llvm/Demangle/ItaniumDemangle.h(667,24): error: 'Protocol' is a private member of 'llvm::itanium_demangle::ObjCProtoName'
  667 |       OB += objcProto->Protocol;
      |                        ^
C:\lldb-aarch64-windows\llvm-project\llvm\include\llvm/Demangle/ItaniumDemangle.h(615,20): note: implicitly declared private here
  615 |   std::string_view Protocol;

Few buildbots broken by #131836 must be green after this patch.

If the includes tree is big enough, `llvm::itanium_demangle::PointerType` may conflict with `llvm::PointerType` from other headers.
This patch fixes the following [error](https://lab.llvm.org/buildbot/#/builders/141/builds/8206):
```
C:\lldb-aarch64-windows\llvm-project\llvm\include\llvm/Demangle/ItaniumDemangle.h(617,16): warning: unqualified friend declaration referring to type outside of the nearest enclosing namespace is a Microsoft extension; add a nested name specifier [-Wmicrosoft-unqualified-friend]
  617 |   friend class PointerType;
      |                ^
      |                ::llvm::
C:\lldb-aarch64-windows\llvm-project\llvm\include\llvm/Demangle/ItaniumDemangle.h(667,24): error: 'Protocol' is a private member of 'llvm::itanium_demangle::ObjCProtoName'
  667 |       OB += objcProto->Protocol;
      |                        ^
C:\lldb-aarch64-windows\llvm-project\llvm\include\llvm/Demangle/ItaniumDemangle.h(615,20): note: implicitly declared private here
  615 |   std::string_view Protocol;
```
@slydiman slydiman added lldb llvm Umbrella label for LLVM issues labels Apr 25, 2025
@slydiman slydiman requested review from Michael137 and labath April 25, 2025 22:28
@llvmbot
Copy link
Member

llvmbot commented Apr 25, 2025

@llvm/pr-subscribers-lldb

Author: Dmitry Vasilyev (slydiman)

Changes

If the includes tree is big enough, llvm::itanium_demangle::PointerType may conflict with llvm::PointerType from other headers. This patch fixes the following error:

C:\lldb-aarch64-windows\llvm-project\llvm\include\llvm/Demangle/ItaniumDemangle.h(617,16): warning: unqualified friend declaration referring to type outside of the nearest enclosing namespace is a Microsoft extension; add a nested name specifier [-Wmicrosoft-unqualified-friend]
  617 |   friend class PointerType;
      |                ^
      |                ::llvm::
C:\lldb-aarch64-windows\llvm-project\llvm\include\llvm/Demangle/ItaniumDemangle.h(667,24): error: 'Protocol' is a private member of 'llvm::itanium_demangle::ObjCProtoName'
  667 |       OB += objcProto->Protocol;
      |                        ^
C:\lldb-aarch64-windows\llvm-project\llvm\include\llvm/Demangle/ItaniumDemangle.h(615,20): note: implicitly declared private here
  615 |   std::string_view Protocol;

Few buildbots broken by #131836 must be green after this patch.


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

1 Files Affected:

  • (modified) llvm/include/llvm/Demangle/ItaniumDemangle.h (+2)
diff --git a/llvm/include/llvm/Demangle/ItaniumDemangle.h b/llvm/include/llvm/Demangle/ItaniumDemangle.h
index b4a4c72021fd1..f37905971a833 100644
--- a/llvm/include/llvm/Demangle/ItaniumDemangle.h
+++ b/llvm/include/llvm/Demangle/ItaniumDemangle.h
@@ -610,6 +610,8 @@ class EnableIfAttr : public Node {
   }
 };
 
+class PointerType;
+
 class ObjCProtoName : public Node {
   const Node *Ty;
   std::string_view Protocol;

@Michael137
Copy link
Member

Michael137 commented Apr 25, 2025

Should have been fixed in this commit: bd96fa7

The bots are now red for other reasons

@Michael137
Copy link
Member

Apologies for the disruption with the buildbots

@slydiman
Copy link
Contributor Author

Closed in favor of bd96fa7

@slydiman slydiman closed this Apr 25, 2025
@slydiman
Copy link
Contributor Author

The bots are now red for other reasons

#131836 (comment)

@slydiman slydiman deleted the fix-ItaniumDemangle branch June 23, 2025 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lldb llvm Umbrella label for LLVM issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants