]> granicus.if.org Git - clang/commitdiff
[libclang] Add attribute support for 'pure', 'const' and 'noduplicate'.
authorJoey Gouly <joey.gouly@gmail.com>
Thu, 1 May 2014 15:41:58 +0000 (15:41 +0000)
committerJoey Gouly <joey.gouly@gmail.com>
Thu, 1 May 2014 15:41:58 +0000 (15:41 +0000)
This bumps CINDEX_VERSION_MINOR up (to 26).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207767 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 21c3f9a8f3883ee491095866b2ffe7fe8bc17f57..81b2f3f6050b16bee5c3cbedfc92e176a9fae481 100644 (file)
@@ -1079,6 +1079,9 @@ CursorKind.CXX_OVERRIDE_ATTR = CursorKind(405)
 CursorKind.ANNOTATE_ATTR = CursorKind(406)
 CursorKind.ASM_LABEL_ATTR = CursorKind(407)
 CursorKind.PACKED_ATTR = CursorKind(408)
+CursorKind.PURE_ATTR = CursorKind(409)
+CursorKind.CONST_ATTR = CursorKind(410)
+CursorKind.NODUPLICATE_ATTR = CursorKind(411)
 
 ###
 # Preprocessing
index 8393c6b7d47ac1079e48cbd89bd01dc21c44ba64..87b1f432fa5dfec50358e9f0755e40283545e8b5 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 25
+#define CINDEX_VERSION_MINOR 26
 
 #define CINDEX_VERSION_ENCODE(major, minor) ( \
       ((major) * 10000)                       \
@@ -2165,7 +2165,10 @@ enum CXCursorKind {
   CXCursor_AnnotateAttr                  = 406,
   CXCursor_AsmLabelAttr                  = 407,
   CXCursor_PackedAttr                    = 408,
-  CXCursor_LastAttr                      = CXCursor_PackedAttr,
+  CXCursor_PureAttr                      = 409,
+  CXCursor_ConstAttr                     = 410,
+  CXCursor_NoDuplicateAttr               = 411,
+  CXCursor_LastAttr                      = CXCursor_NoDuplicateAttr,
      
   /* Preprocessing */
   CXCursor_PreprocessingDirective        = 500,
index 3e60e6c0e4958d162a8f1864ab8c25ab9ae088ea..95d9c7548bd7b24f7e0c48abb8d40883a62191be 100644 (file)
@@ -4,7 +4,17 @@ struct __attribute__((packed)) Test2 {
   char a;
 };
 
+void pure_fn() __attribute__((pure));
+void const_fn() __attribute__((const));
+void noduplicate_fn() __attribute__((noduplicate));
+
 // 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]
 
+// CHECK: attributes.c:7:6: FunctionDecl=pure_fn:7:6 Extent=[7:1 - 7:37]
+// CHECK: attributes.c:7:31: attribute(pure)= Extent=[7:31 - 7:35]
+// CHECK: attributes.c:8:6: FunctionDecl=const_fn:8:6 Extent=[8:1 - 8:39]
+// CHECK: attributes.c:8:32: attribute(const)= Extent=[8:32 - 8:37]
+// CHECK: attributes.c:9:6: FunctionDecl=noduplicate_fn:9:6 Extent=[9:1 - 9:51]
+// CHECK: attributes.c:9:38: attribute(noduplicate)= Extent=[9:38 - 9:49]
index 26b3bf16af2d1ea4d088ca165b00be8f8953348f..5191dbfa9b7d6cb49c6dcaeea800b6753a613853 100644 (file)
@@ -3867,6 +3867,12 @@ CXString clang_getCursorKindSpelling(enum CXCursorKind Kind) {
     return cxstring::createRef("asm label");
   case CXCursor_PackedAttr:
     return cxstring::createRef("attribute(packed)");
+  case CXCursor_PureAttr:
+    return cxstring::createRef("attribute(pure)");
+  case CXCursor_ConstAttr:
+    return cxstring::createRef("attribute(const)");
+  case CXCursor_NoDuplicateAttr:
+    return cxstring::createRef("attribute(noduplicate)");
   case CXCursor_PreprocessingDirective:
     return cxstring::createRef("preprocessing directive");
   case CXCursor_MacroDefinition:
index d682986b3f3c57a3685bb9b7f5f4e3833efa0837..fb4ce66d3ac4ed633bd07f9bbfc87a8b6aa7a750 100644 (file)
@@ -50,6 +50,9 @@ static CXCursorKind GetCursorKind(const Attr *A) {
     case attr::Annotate: return CXCursor_AnnotateAttr;
     case attr::AsmLabel: return CXCursor_AsmLabelAttr;
     case attr::Packed: return CXCursor_PackedAttr;
+    case attr::Pure: return CXCursor_PureAttr;
+    case attr::Const: return CXCursor_ConstAttr;
+    case attr::NoDuplicate: return CXCursor_NoDuplicateAttr;
   }
 
   return CXCursor_UnexposedAttr;