[libcxx-commits] [libcxxabi] bd96fa7 - [ItaniumDemangle][NFC] Add getter to ObjCProtoName::getProtocol
Michael Buch via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Apr 25 14:12:57 PDT 2025
Author: Michael Buch
Date: 2025-04-25T22:12:39+01:00
New Revision: bd96fa778809d70e688d27cae2f7667b2aed69c0
URL: https://github.com/llvm/llvm-project/commit/bd96fa778809d70e688d27cae2f7667b2aed69c0
DIFF: https://github.com/llvm/llvm-project/commit/bd96fa778809d70e688d27cae2f7667b2aed69c0.diff
LOG: [ItaniumDemangle][NFC] Add getter to ObjCProtoName::getProtocol
And remove now redunant friend declaration.
For some reason this was failing to build on one of the MSVC bots after
https://github.com/llvm/llvm-project/pull/131836:
```
FAILED: tools/lldb/source/Plugins/ExpressionParser/Clang/CMakeFiles/lldbPluginExpressionParserClang.dir/ClangExpressionParser.cpp.obj
ccache C:\PROGRA~1\MICROS~1\2022\COMMUN~1\VC\Tools\MSVC\1441~1.341\bin\Hostx64\x64\cl.exe /nologo /TP -DCLANG_BUILD_STATIC -DGTEST_HAS_RTTI=0 -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_ENABLE_EXTENDED_ALIGNED_STORAGE -D_GLIBCXX_ASSERTIONS -D_HAS_EXCEPTIONS=0 -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -IC:\buildbot\as-builder-10\lldb-x-aarch64\build\tools\lldb\source\Plugins\ExpressionParser\Clang -IC:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\source\Plugins\ExpressionParser\Clang -IC:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\include -IC:\buildbot\as-builder-10\lldb-x-aarch64\build\tools\lldb\include -IC:\buildbot\as-builder-10\lldb-x-aarch64\build\include -IC:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\llvm\include -IC:\Python312\include -IC:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\llvm\..\clang\include -IC:\buildbot\as-builder-10\lldb-x-aarch64\build\tools\lldb\..\clang\include -IC:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\source -IC:\buildbot\as-builder-10\lldb-x-aarch64\build\tools\lldb\source -D__OPTIMIZE__ /Zc:inline /Zc:preprocessor /Zc:__cplusplus /Oi /bigobj /permissive- /W4 -wd4141 -wd4146 -wd4244 -wd4267 -wd4291 -wd4351 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245 -wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577 -wd4091 -wd4592 -wd4319 -wd4709 -wd5105 -wd4324 -wd4251 -wd4275 -w14062 -we4238 /Gw /O2 /Ob2 -MD -wd4018 -wd4068 -wd4150 -wd4201 -wd4251 -wd4521 -wd4530 -wd4589 /EHs-c- /GR- -UNDEBUG -std:c++17 /showIncludes /Fotools\lldb\source\Plugins\ExpressionParser\Clang\CMakeFiles\lldbPluginExpressionParserClang.dir\ClangExpressionParser.cpp.obj /Fdtools\lldb\source\Plugins\ExpressionParser\Clang\CMakeFiles\lldbPluginExpressionParserClang.dir\lldbPluginExpressionParserClang.pdb /FS -c C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\source\Plugins\ExpressionParser\Clang\ClangExpressionParser.cpp
C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\llvm\include\llvm/Demangle/ItaniumDemangle.h(667): error C2248: 'llvm::itanium_demangle::ObjCProtoName::Protocol': cannot access private member declared in class 'llvm::itanium_demangle::ObjCProtoName'
C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\llvm\include\llvm/Demangle/ItaniumDemangle.h(615): note: see declaration of 'llvm::itanium_demangle::ObjCProtoName::Protocol'
C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\llvm\include\llvm/Demangle/ItaniumDemangle.h(613): note: see declaration of 'llvm::itanium_demangle::ObjCProtoName'
```
It's not quite clear to me why this wasn't compiling but either way this
is cleaner.
Added:
Modified:
libcxxabi/src/demangle/ItaniumDemangle.h
llvm/include/llvm/Demangle/ItaniumDemangle.h
Removed:
################################################################################
diff --git a/libcxxabi/src/demangle/ItaniumDemangle.h b/libcxxabi/src/demangle/ItaniumDemangle.h
index 69932e63669bf..5baafd2ae0d0b 100644
--- a/libcxxabi/src/demangle/ItaniumDemangle.h
+++ b/libcxxabi/src/demangle/ItaniumDemangle.h
@@ -614,8 +614,6 @@ class ObjCProtoName : public Node {
const Node *Ty;
std::string_view Protocol;
- friend class PointerType;
-
public:
ObjCProtoName(const Node *Ty_, std::string_view Protocol_)
: Node(KObjCProtoName), Ty(Ty_), Protocol(Protocol_) {}
@@ -627,6 +625,8 @@ class ObjCProtoName : public Node {
static_cast<const NameType *>(Ty)->getName() == "objc_object";
}
+ std::string_view getProtocol() const { return Protocol; }
+
void printLeft(OutputBuffer &OB) const override {
Ty->print(OB);
OB += "<";
@@ -664,7 +664,7 @@ class PointerType final : public Node {
} else {
const auto *objcProto = static_cast<const ObjCProtoName *>(Pointee);
OB += "id<";
- OB += objcProto->Protocol;
+ OB += objcProto->getProtocol();
OB += ">";
}
}
diff --git a/llvm/include/llvm/Demangle/ItaniumDemangle.h b/llvm/include/llvm/Demangle/ItaniumDemangle.h
index b4a4c72021fd1..67d6152c747dd 100644
--- a/llvm/include/llvm/Demangle/ItaniumDemangle.h
+++ b/llvm/include/llvm/Demangle/ItaniumDemangle.h
@@ -614,8 +614,6 @@ class ObjCProtoName : public Node {
const Node *Ty;
std::string_view Protocol;
- friend class PointerType;
-
public:
ObjCProtoName(const Node *Ty_, std::string_view Protocol_)
: Node(KObjCProtoName), Ty(Ty_), Protocol(Protocol_) {}
@@ -627,6 +625,8 @@ class ObjCProtoName : public Node {
static_cast<const NameType *>(Ty)->getName() == "objc_object";
}
+ std::string_view getProtocol() const { return Protocol; }
+
void printLeft(OutputBuffer &OB) const override {
Ty->print(OB);
OB += "<";
@@ -664,7 +664,7 @@ class PointerType final : public Node {
} else {
const auto *objcProto = static_cast<const ObjCProtoName *>(Pointee);
OB += "id<";
- OB += objcProto->Protocol;
+ OB += objcProto->getProtocol();
OB += ">";
}
}
More information about the libcxx-commits
mailing list