diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-10-06 10:55:34 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-10-06 10:55:34 +0200 |
commit | 0e3a58441644faa14698a44f2ed682150430529a (patch) | |
tree | de19c693a802abf6f020867f6ca8e912b0d019c6 /sources/shiboken2/ApiExtractor | |
parent | 82934bc00c2de7ea51fd7e95601472fcdf7b6aea (diff) | |
parent | b57f329ecbf1fd0b29ae0e8284c885adc0eb4ed3 (diff) |
Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: I7b4ff138799ee81940c36e68a105cb42bb38a3ff
Diffstat (limited to 'sources/shiboken2/ApiExtractor')
-rw-r--r-- | sources/shiboken2/ApiExtractor/apiextractor.cpp | 19 | ||||
-rw-r--r-- | sources/shiboken2/ApiExtractor/apiextractor.h | 2 |
2 files changed, 19 insertions, 2 deletions
diff --git a/sources/shiboken2/ApiExtractor/apiextractor.cpp b/sources/shiboken2/ApiExtractor/apiextractor.cpp index 3fdd613ae..aa552cdd3 100644 --- a/sources/shiboken2/ApiExtractor/apiextractor.cpp +++ b/sources/shiboken2/ApiExtractor/apiextractor.cpp @@ -172,7 +172,20 @@ int ApiExtractor::classCount() const return m_builder->classes().count(); } -bool ApiExtractor::run() +// Add defines required for parsing Qt code headers +static void addPySideExtensions(QByteArrayList *a) +{ + // Make "signals:", "slots:" visible as access specifiers + a->append(QByteArrayLiteral("-DQT_ANNOTATE_ACCESS_SPECIFIER(a)=__attribute__((annotate(#a)))")); + + // Q_PROPERTY is defined as class annotation which does not work since a + // sequence of properties will to expand to a sequence of annotations + // annotating nothing, causing clang to complain. Instead, define it away in a + // static assert with the stringified argument in a ','-operator (cf qdoc). + a->append(QByteArrayLiteral("-DQT_ANNOTATE_CLASS(type,...)=static_assert(sizeof(#__VA_ARGS__),#type);")); +} + +bool ApiExtractor::run(bool usePySideExtensions) { if (m_builder) return false; @@ -215,6 +228,10 @@ bool ApiExtractor::run() << "clang language level: " << int(m_languageLevel) << "\nclang arguments: " << arguments; } + + if (usePySideExtensions) + addPySideExtensions(&arguments); + const bool result = m_builder->build(arguments, m_languageLevel); if (!result) autoRemove = false; diff --git a/sources/shiboken2/ApiExtractor/apiextractor.h b/sources/shiboken2/ApiExtractor/apiextractor.h index b0c2c696f..9c79ae7a5 100644 --- a/sources/shiboken2/ApiExtractor/apiextractor.h +++ b/sources/shiboken2/ApiExtractor/apiextractor.h @@ -93,7 +93,7 @@ public: int classCount() const; - bool run(); + bool run(bool usePySideExtensions); private: QString m_typeSystemFileName; QFileInfoList m_cppFileNames; |