aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2017-09-04 14:58:20 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2017-09-04 14:04:54 +0000
commitdb904f8e9ed06eac37151c9a8b955c63c1eb8a46 (patch)
treeb15c20d358193718263baacab0839ba46d2aaeb3
parent182edcee26e49f7caebf6b30fd1b1d9469a48e4e (diff)
Windows: Do not consider gl.h a system include file
Amends 10453490629859a01048d0b21688d6617279eeaf. Task-number: PYSIDE-516 Change-Id: Ie4bc2008669e4e34bedf0575de3ff75adbc2413e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp
index a739756a..9fff9af8 100644
--- a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp
+++ b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp
@@ -516,7 +516,25 @@ Builder::~Builder()
bool Builder::visitLocation(const CXSourceLocation &location) const
{
- return !clang_Location_isInSystemHeader(location);
+ if (clang_Location_isInSystemHeader(location) == 0)
+ return true;
+#ifdef Q_OS_WIN
+ CXFile file; // void *
+ unsigned line;
+ unsigned column;
+ unsigned offset;
+ clang_getExpansionLocation(location, &file, &line, &column, &offset);
+ const CXString cxFileName = clang_getFileName(file);
+ // Has been observed to be 0 for invalid locations
+ if (const char *cFileName = clang_getCString(cxFileName)) {
+ // Resolve OpenGL typedefs although the header is considered a system header.
+ const bool visitHeader = _stricmp(cFileName, "GL/gl.h") || _stricmp(cFileName, "gl.h") == 0;
+ clang_disposeString(cxFileName);
+ if (visitHeader)
+ return true;
+ }
+#endif // Q_OS_WIN
+ return false;
}
FileModelItem Builder::dom() const