aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/generator/generator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken2/generator/generator.cpp')
-rw-r--r--sources/shiboken2/generator/generator.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/sources/shiboken2/generator/generator.cpp b/sources/shiboken2/generator/generator.cpp
index 88ba1f04f..4eabb3d2c 100644
--- a/sources/shiboken2/generator/generator.cpp
+++ b/sources/shiboken2/generator/generator.cpp
@@ -558,7 +558,9 @@ QTextStream &formatCode(QTextStream &s, const QString &code, Indentor &indentor)
Q_ASSERT(emptyLine.isValid());
for (QString line : lst) {
- if (!line.isEmpty() && !emptyLine.match(line).hasMatch()) {
+ if (line.startsWith(QLatin1Char('#'))) {
+ s << line; // Do not indent preprocessor lines
+ } else if (!line.isEmpty() && !emptyLine.match(line).hasMatch()) {
while (line.constEnd()->isSpace())
line.chop(1);
int limit = 0;