summaryrefslogtreecommitdiffstats
path: root/clang/tools/libclang/CIndex.cpp
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2017-07-12 11:31:37 +0000
committerAlex Lorenz <arphaman@gmail.com>2017-07-12 11:31:37 +0000
commit571b8cfac94bf030c8db74dc24e28301480ecb96 (patch)
tree61d0b4edf903e6832eddb1c0f8236933cb2a62b2 /clang/tools/libclang/CIndex.cpp
parentdab1d5f3cd6000da8b1e6bb1110c8788ac6a8aa1 (diff)
downloadbcm5719-llvm-571b8cfac94bf030c8db74dc24e28301480ecb96.tar.gz
bcm5719-llvm-571b8cfac94bf030c8db74dc24e28301480ecb96.zip
[libclang] Support for querying whether an enum is scoped
This commit allows checking whether an enum declaration is scoped through libclang and clang.cindex (Python). Differential Revision: https://reviews.llvm.org/D35187 llvm-svn: 307769
Diffstat (limited to 'clang/tools/libclang/CIndex.cpp')
-rw-r--r--clang/tools/libclang/CIndex.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index 2cbca421c78..236f264c175 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/tools/libclang/CIndex.cpp
@@ -7807,6 +7807,15 @@ unsigned clang_CXXMethod_isVirtual(CXCursor C) {
return (Method && Method->isVirtual()) ? 1 : 0;
}
+unsigned clang_EnumDecl_isScoped(CXCursor C) {
+ if (!clang_isDeclaration(C.kind))
+ return 0;
+
+ const Decl *D = cxcursor::getCursorDecl(C);
+ auto *Enum = dyn_cast_or_null<EnumDecl>(D);
+ return (Enum && Enum->isScoped()) ? 1 : 0;
+}
+
//===----------------------------------------------------------------------===//
// Attribute introspection.
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud