diff options
author | Stefan Brüns <stefan.bruens@rwth-aachen.de> | 2018-08-17 05:30:40 +0200 |
---|---|---|
committer | Stefan Brüns <stefan.bruens@rwth-aachen.de> | 2018-08-25 04:14:41 +0200 |
commit | 1790a6994a3536a9d6c73901cb7898615eb64861 (patch) | |
tree | 938cc8383b41bc1556e1ce6f3e5f7170b08df8e6 /find-modules | |
parent | 4b59c77083625219238d6e12d11554b7fd685a7a (diff) | |
download | extra-cmake-modules-1790a6994a3536a9d6c73901cb7898615eb64861.tar.gz extra-cmake-modules-1790a6994a3536a9d6c73901cb7898615eb64861.tar.bz2 |
Bindings: Add support for scoped enums
Summary:
Keep the enum intact by emitting the class keyword in case the enum is
scoped.
Use the complete enum scope for parameter values, the enclosing scope is
only correct to use for unscoped enums.
The python Cursor.is_scoped_enum() method has been added with LLVM/Clang
version 5.0.
BUG: 397154
Test Plan: build kcoreaddons
Reviewers: #frameworks, mpyne
Reviewed By: mpyne
Subscribers: mpyne, kde-frameworks-devel, kde-buildsystem
Tags: #frameworks, #build_system
Differential Revision: https://phabricator.kde.org/D14908
Diffstat (limited to 'find-modules')
-rw-r--r-- | find-modules/FindPythonModuleGeneration.cmake | 10 | ||||
-rw-r--r-- | find-modules/sip_generator.py | 10 |
2 files changed, 10 insertions, 10 deletions
diff --git a/find-modules/FindPythonModuleGeneration.cmake b/find-modules/FindPythonModuleGeneration.cmake index 1d6079e9..2362c454 100644 --- a/find-modules/FindPythonModuleGeneration.cmake +++ b/find-modules/FindPythonModuleGeneration.cmake @@ -180,7 +180,7 @@ endif() if (NOT libclang_LIBRARY) set(_LIBCLANG_MAX_MAJOR_VERSION 7) - set(_LIBCLANG_MIN_MAJOR_VERSION 4) + set(_LIBCLANG_MIN_MAJOR_VERSION 5) find_library(libclang_LIBRARY clang-${_LIBCLANG_MAX_MAJOR_VERSION}.0) @@ -196,12 +196,6 @@ if (NOT libclang_LIBRARY) endwhile() if (NOT libclang_LIBRARY) - find_library(libclang_LIBRARY clang-3.9) - if (NOT libclang_LIBRARY) - find_library(libclang_LIBRARY clang-3.8) - endif() - endif() - if (NOT libclang_LIBRARY) find_library(libclang_LIBRARY clang) endif() else() @@ -210,7 +204,7 @@ else() endif() if (NOT libclang_LIBRARY) - _report_NOT_FOUND("Could not find libclang version 3.8 or greater.") + _report_NOT_FOUND("Could not find libclang version 5.0 or greater.") else() message(STATUS "Found ${libclang_LIBRARY}") endif() diff --git a/find-modules/sip_generator.py b/find-modules/sip_generator.py index 58ae1829..1ebaba61 100644 --- a/find-modules/sip_generator.py +++ b/find-modules/sip_generator.py @@ -416,7 +416,10 @@ class SipGenerator(object): def _enum_get(self, container, enum, level): pad = " " * (level * 4) - decl = pad + "enum {} {{\n".format(enum.displayname) + scoped = "" + if enum.is_scoped_enum(): + scoped = "class " + decl = pad + "enum {}{} {{\n".format(scoped, enum.displayname) enumerations = [] for enum in enum.get_children(): # @@ -609,7 +612,10 @@ class SipGenerator(object): typeText = text typeInit = "" - prefix = parameterType.spelling.rsplit("::", 1)[0] + if parameterType.kind == TypeKind.ENUM and parameterType.get_declaration().is_scoped_enum(): + prefix = parameterType.spelling + else: + prefix = parameterType.spelling.rsplit("::", 1)[0] if "::" in typeText: typeText = typeText.rsplit("::", 1)[1] return prefix + "::" + typeText + typeInit |