diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-05-31 13:05:19 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-06-19 11:57:08 +0000 |
commit | e47bfb4354e0e1e32413f3187394fbcde8ec0fc0 (patch) | |
tree | b4d65dc6a1460842131f743fbb271f2b6d7e4458 | |
parent | a3e4e367cf462e2dd9d7b08fe8d3f0007c33e1fa (diff) |
Change parsing to #include the source header
shiboken is normally run on a global header that includes
all classes to be wrapped. However, when passing a header
that contains the class declaration, it happens that
the temporary copy of the header (being the location of the class
declaration) is stored as required #include
by the generators. Fix by using #include instead, so that the original
header from the command line is seen as location.
Task-number: PYSIDE-526
Change-Id: Ie30a8a2b21606c9f6ed5dda3447885576fdc4c2c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r-- | sources/shiboken2/ApiExtractor/apiextractor.cpp | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/sources/shiboken2/ApiExtractor/apiextractor.cpp b/sources/shiboken2/ApiExtractor/apiextractor.cpp index bce3a6e3f..404e0bea6 100644 --- a/sources/shiboken2/ApiExtractor/apiextractor.cpp +++ b/sources/shiboken2/ApiExtractor/apiextractor.cpp @@ -43,18 +43,6 @@ #include "typedatabase.h" #include "typesystem.h" -static bool appendFile(const QString& sourceFileName, QFile& targetFile) -{ - QFile sourceFile(sourceFileName); - if (!sourceFile.open(QIODevice::ReadOnly | QIODevice::Text)) { - std::cerr << "Cannot open " << qPrintable(QDir::toNativeSeparators(sourceFileName)) - << ": " << qPrintable(sourceFile.errorString()) << '\n'; - return false; - } - targetFile.write(sourceFile.readAll()); - return true; -} - ApiExtractor::ApiExtractor() : m_builder(0) { // Environment TYPESYSTEMPATH @@ -258,9 +246,9 @@ bool ApiExtractor::run() << ": " << qPrintable(ppFile.errorString()) << '\n'; return false; } - - if (!appendFile(m_cppFileName, ppFile)) - return false; + ppFile.write("#include \""); + ppFile.write(m_cppFileName.toLocal8Bit()); + ppFile.write("\"\n"); const QString preprocessedCppFileName = ppFile.fileName(); ppFile.close(); m_builder = new AbstractMetaBuilder; |