]> granicus.if.org Git - clang/commitdiff
[libclang] Add attribute support for 'convergent'.
authorSven van Haastregt <sven.vanhaastregt@arm.com>
Mon, 11 Feb 2019 11:00:56 +0000 (11:00 +0000)
committerSven van Haastregt <sven.vanhaastregt@arm.com>
Mon, 11 Feb 2019 11:00:56 +0000 (11:00 +0000)
This bumps CINDEX_VERSION_MINOR up (to 51).

Patch by Hsin-Hsiao Lin.

Differential Revision: https://reviews.llvm.org/D57946

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@353690 91177308-0d34-0410-b5e6-96231b3b80d8

bindings/python/clang/cindex.py
include/clang-c/Index.h
test/Index/attributes.c
tools/libclang/CIndex.cpp
tools/libclang/CXCursor.cpp

index 2c97d01a104a7e6cd5e82809576fd1a079acaa92..8630c59c135990ef8f8379e8befd1ebf7e7a902b 100644 (file)
@@ -1342,6 +1342,7 @@ CursorKind.VISIBILITY_ATTR = CursorKind(417)
 
 CursorKind.DLLEXPORT_ATTR = CursorKind(418)
 CursorKind.DLLIMPORT_ATTR = CursorKind(419)
+CursorKind.CONVERGENT_ATTR = CursorKind(420)
 
 ###
 # Preprocessing
index 3dd8432609d2368e31fd4cf192bf2f52e415b4d4..38af8aa6d8b6c3783df76a6446d52452bff789f0 100644 (file)
@@ -32,7 +32,7 @@
  * compatible, thus CINDEX_VERSION_MAJOR is expected to remain stable.
  */
 #define CINDEX_VERSION_MAJOR 0
-#define CINDEX_VERSION_MINOR 50
+#define CINDEX_VERSION_MINOR 51
 
 #define CINDEX_VERSION_ENCODE(major, minor) ( \
       ((major) * 10000)                       \
@@ -2586,7 +2586,8 @@ enum CXCursorKind {
   CXCursor_ObjCRuntimeVisible            = 435,
   CXCursor_ObjCBoxable                   = 436,
   CXCursor_FlagEnum                      = 437,
-  CXCursor_LastAttr                      = CXCursor_FlagEnum,
+  CXCursor_ConvergentAttr                = 438,
+  CXCursor_LastAttr                      = CXCursor_ConvergentAttr,
 
   /* Preprocessing */
   CXCursor_PreprocessingDirective        = 500,
index e3b2c1ab7a7d38d90dfcb6f820c7ead5739c0229..3aedacd33fa4b648c8bdfb2fbf5bb5aeb2d89b8c 100644 (file)
@@ -12,6 +12,8 @@ enum __attribute((flag_enum)) FlagEnum {
   Foo
 };
 
+void convergent_fn() __attribute__((convergent));
+
 // CHECK: attributes.c:3:32: StructDecl=Test2:3:32 (Definition) Extent=[3:1 - 5:2]
 // CHECK: attributes.c:3:23: attribute(packed)=packed Extent=[3:23 - 3:29]
 // CHECK: attributes.c:4:8: FieldDecl=a:4:8 (Definition) Extent=[4:3 - 4:9] [access=public]
@@ -24,3 +26,6 @@ enum __attribute((flag_enum)) FlagEnum {
 // CHECK: attributes.c:9:38: attribute(noduplicate)= Extent=[9:38 - 9:49]
 // CHECK: attributes.c:11:31: EnumDecl=FlagEnum:11:31 (Definition) Extent=[11:1 - 13:2]
 // CHECK: attributes.c:11:19: attribute(flag_enum)= Extent=[11:19 - 11:28]
+// CHECK: attributes.c:12:3: EnumConstantDecl=Foo:12:3 (Definition) Extent=[12:3 - 12:6]
+// CHECK: attributes.c:15:6: FunctionDecl=convergent_fn:15:6 Extent=[15:1 - 15:49]
+// CHECK: attributes.c:15:37: attribute(convergent)= Extent=[15:37 - 15:47]
index 4287222b15e90708bc288192924d11e9ca35745c..a931fccdf60f0838b2a959bba74c35557c2ba9c7 100644 (file)
@@ -5474,7 +5474,9 @@ CXString clang_getCursorKindSpelling(enum CXCursorKind Kind) {
   case CXCursor_StaticAssert:
       return cxstring::createRef("StaticAssert");
   case CXCursor_FriendDecl:
-    return cxstring::createRef("FriendDecl");
+      return cxstring::createRef("FriendDecl");
+  case CXCursor_ConvergentAttr:
+      return cxstring::createRef("attribute(convergent)");
   }
 
   llvm_unreachable("Unhandled CXCursorKind");
index 1eeab63da6737914095dd73be916cee4e1aaf708..fdd24261cb1bdf011290145303b835e5d56147b9 100644 (file)
@@ -78,6 +78,7 @@ static CXCursorKind GetCursorKind(const Attr *A) {
     case attr::ObjCRuntimeVisible: return CXCursor_ObjCRuntimeVisible;
     case attr::ObjCBoxable: return CXCursor_ObjCBoxable;
     case attr::FlagEnum: return CXCursor_FlagEnum;
+    case attr::Convergent: return CXCursor_ConvergentAttr;
   }
 
   return CXCursor_UnexposedAttr;