aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/ApiExtractor/clangparser/clangutils.h
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-02-01 17:34:02 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2021-02-01 18:31:54 +0000
commit9da07f8145b38f4483fed94fbc3148af872b08ec (patch)
tree15bdb9d4b24cfac502079f9cdfebbfeb1beabe34 /sources/shiboken6/ApiExtractor/clangparser/clangutils.h
parent826f501f0761735f0a4ddda82d84a2fd832f4323 (diff)
shiboken6: Fix a crash when printing clang diagnostics
The CXFile struct used in the Diagnostic struct representing a diagnostic message is invalid after clang parsing has finished and causes a crash when printing. Expand it to a QString at creation time. Apparently, this occurred with recent clang versions. Pick-to: 6.0 Pick-to: 5.15 Change-Id: I297014e272d6814f04e8f0273e8ae79ab8264138 Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/shiboken6/ApiExtractor/clangparser/clangutils.h')
-rw-r--r--sources/shiboken6/ApiExtractor/clangparser/clangutils.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/sources/shiboken6/ApiExtractor/clangparser/clangutils.h b/sources/shiboken6/ApiExtractor/clangparser/clangutils.h
index d29addd2b..0182c0dde 100644
--- a/sources/shiboken6/ApiExtractor/clangparser/clangutils.h
+++ b/sources/shiboken6/ApiExtractor/clangparser/clangutils.h
@@ -68,7 +68,7 @@ struct SourceLocation
{
bool equals(const SourceLocation &rhs) const;
- CXFile file;
+ CXFile file = nullptr;
unsigned line = 0;
unsigned column = 0;
unsigned offset = 0;
@@ -96,10 +96,14 @@ struct Diagnostic {
static Diagnostic fromCXDiagnostic(CXDiagnostic cd);
// Other
explicit Diagnostic(const QString &m, const CXCursor &c, CXDiagnosticSeverity s = CXDiagnostic_Warning);
+ void setLocation(const SourceLocation &);
QString message;
QStringList childMessages;
- SourceLocation location;
+ QString file;
+ unsigned line = 0;
+ unsigned column = 0;
+ unsigned offset = 0;
Source source = Clang;
CXDiagnosticSeverity severity = CXDiagnostic_Warning;
};