diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-07-10 07:37:04 +0200 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-07-10 07:37:04 +0200 |
| commit | b49d3517e6b82eb40d7deff523cd127ba1348eb8 (patch) | |
| tree | ca0b48341711649f4f129089729e95bb32228f66 /sources/shiboken2/ApiExtractor/clangparser/clangutils.cpp | |
| parent | efffa046b8aed56a832f5159ca172e0393c24f1d (diff) | |
| parent | 3a0b9ebc9e2980af8dc5fbf4ac8bc6ddfd49c9d9 (diff) | |
Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: I8c4ad13f119c4696a52e6feccdf4dead3ed7f472
Diffstat (limited to 'sources/shiboken2/ApiExtractor/clangparser/clangutils.cpp')
| -rw-r--r-- | sources/shiboken2/ApiExtractor/clangparser/clangutils.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangutils.cpp b/sources/shiboken2/ApiExtractor/clangparser/clangutils.cpp index df2476100..6bf2e3ab0 100644 --- a/sources/shiboken2/ApiExtractor/clangparser/clangutils.cpp +++ b/sources/shiboken2/ApiExtractor/clangparser/clangutils.cpp @@ -60,15 +60,25 @@ QtCompatHashFunctionType qHash(const CXType &ct, QtCompatHashFunctionType seed) namespace clang { +bool SourceLocation::equals(const SourceLocation &rhs) const +{ + return file == rhs.file && offset == rhs.offset; +} + SourceLocation getExpansionLocation(const CXSourceLocation &location) { SourceLocation result; - CXFile file; // void * - clang_getExpansionLocation(location, &file, &result.line, &result.column, &result.offset); + clang_getExpansionLocation(location, &result.file, &result.line, &result.column, &result.offset); + return result; +} + +QString getFileName(CXFile file) +{ + QString result; const CXString cxFileName = clang_getFileName(file); // Has been observed to be 0 for invalid locations if (const char *cFileName = clang_getCString(cxFileName)) - result.file = QString::fromUtf8(cFileName); + result = QString::fromUtf8(cFileName); clang_disposeString(cxFileName); return result; } @@ -226,7 +236,7 @@ QDebug operator<<(QDebug s, const SourceLocation &l) QDebugStateSaver saver(s); s.nospace(); s.noquote(); - s << QDir::toNativeSeparators(l.file) << ':' << l.line; + s << QDir::toNativeSeparators(clang::getFileName(l.file)) << ':' << l.line; if (l.column) s << ':' << l.column; return s; |
