aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/generator/shiboken/headergenerator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken6/generator/shiboken/headergenerator.cpp')
-rw-r--r--sources/shiboken6/generator/shiboken/headergenerator.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/sources/shiboken6/generator/shiboken/headergenerator.cpp b/sources/shiboken6/generator/shiboken/headergenerator.cpp
index c7039d2b1..4d02bda3d 100644
--- a/sources/shiboken6/generator/shiboken/headergenerator.cpp
+++ b/sources/shiboken6/generator/shiboken/headergenerator.cpp
@@ -63,6 +63,13 @@ static bool alwaysGenerateDestructorDeclaration()
return clang::compiler() == Compiler::Msvc;
}
+const char *HeaderGenerator::protectedHackDefine = R"(// Workaround to access protected functions
+#ifndef protected
+# define protected public
+#endif
+
+)";
+
QString HeaderGenerator::fileNameForContext(const GeneratorContext &context) const
{
return headerFileNameForContext(context);
@@ -99,7 +106,7 @@ void HeaderGenerator::generateClass(TextStream &s, const GeneratorContext &class
s << "#define SBK_" << outerHeaderGuard << "_H\n\n";
if (!avoidProtectedHack())
- s << "#define protected public\n\n";
+ s << protectedHackDefine;
//Includes
s << metaClass->typeEntry()->include() << '\n';