From db904f8e9ed06eac37151c9a8b955c63c1eb8a46 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 4 Sep 2017 14:58:20 +0200 Subject: Windows: Do not consider gl.h a system include file Amends 10453490629859a01048d0b21688d6617279eeaf. Task-number: PYSIDE-516 Change-Id: Ie4bc2008669e4e34bedf0575de3ff75adbc2413e Reviewed-by: Alexandru Croitor --- .../ApiExtractor/clangparser/clangbuilder.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp index a739756a7..9fff9af8b 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 -- cgit v1.2.3