Start adding cursor kinds for attributes, with first exposing
IBActionAttr and IBOutletAttr respectively.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96563 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h
index 2ff6a97..0c67104 100644
--- a/include/clang-c/Index.h
+++ b/include/clang-c/Index.h
@@ -764,7 +764,19 @@
    * The translation unit cursor exists primarily to act as the root
    * cursor for traversing the contents of a translation unit.
    */
-  CXCursor_TranslationUnit               = 300
+  CXCursor_TranslationUnit               = 300,
+
+  /* Attributes */
+  CXCursor_FirstAttr                     = 400,
+  /**
+   * \brief An attribute whose specific kind is not exposed via this
+   * interface.
+   */
+  CXCursor_UnexposedAttr                 = 400,
+
+  CXCursor_IBActionAttr                  = 401,
+  CXCursor_IBOutletAttr                  = 402,
+  CXCursor_LastAttr                      = CXCursor_IBOutletAttr
 };
 
 /**
diff --git a/tools/CIndex/CIndex.cpp b/tools/CIndex/CIndex.cpp
index 5fc6168..21f3860 100644
--- a/tools/CIndex/CIndex.cpp
+++ b/tools/CIndex/CIndex.cpp
@@ -1441,6 +1441,12 @@
       return createCXString("NotImplemented");
   case CXCursor_TranslationUnit:
       return createCXString("TranslationUnit");
+  case CXCursor_UnexposedAttr:
+      return createCXString("UnexposedAttr");
+  case CXCursor_IBActionAttr:
+      return createCXString("attribute(ibaction)");
+    case CXCursor_IBOutletAttr:
+      return createCXString("attribute(iboutlet)");
   }
 
   llvm_unreachable("Unhandled CXCursorKind");
diff --git a/tools/CIndex/CXCursor.cpp b/tools/CIndex/CXCursor.cpp
index ec1477e..0fa73a5 100644
--- a/tools/CIndex/CXCursor.cpp
+++ b/tools/CIndex/CXCursor.cpp
@@ -72,6 +72,23 @@
   return CXCursor_NotImplemented;  
 }
 
+static CXCursorKind GetCursorKind(const Attr *A) {
+  assert(A && "Invalid arguments!");
+  switch (A->getKind()) {
+    default: break;
+    case Attr::IBActionKind: return CXCursor_IBActionAttr;
+    case Attr::IBOutletKind: return CXCursor_IBOutletAttr;
+  }
+
+  return CXCursor_UnexposedAttr;
+}
+
+CXCursor cxcursor::MakeCXCursor(const Attr *A, Decl *Parent, ASTUnit *TU) {
+  assert(A && Parent && TU && "Invalid arguments!");
+  CXCursor C = { GetCursorKind(A), { Parent, (void*)A, TU } };
+  return C;
+}
+
 CXCursor cxcursor::MakeCXCursor(Decl *D, ASTUnit *TU) {
   assert(D && TU && "Invalid arguments!");
   CXCursor C = { GetCursorKind(D), { D, 0, TU } };
diff --git a/tools/CIndex/CXCursor.h b/tools/CIndex/CXCursor.h
index 30fb26c..934d5e2 100644
--- a/tools/CIndex/CXCursor.h
+++ b/tools/CIndex/CXCursor.h
@@ -22,6 +22,7 @@
 
 class ASTContext;
 class ASTUnit;
+class Attr;
 class Decl;
 class Expr;
 class NamedDecl;
@@ -32,9 +33,10 @@
 
 namespace cxcursor {
   
-CXCursor MakeCXCursorInvalid(CXCursorKind K);
-CXCursor MakeCXCursor(clang::Stmt *S, clang::Decl *Parent, ASTUnit *TU);
+CXCursor MakeCXCursor(const clang::Attr *A, clang::Decl *Parent, ASTUnit *TU);
 CXCursor MakeCXCursor(clang::Decl *D, ASTUnit *TU);
+CXCursor MakeCXCursor(clang::Stmt *S, clang::Decl *Parent, ASTUnit *TU);
+CXCursor MakeCXCursorInvalid(CXCursorKind K);
 
 /// \brief Create an Objective-C superclass reference at the given location.
 CXCursor MakeCursorObjCSuperClassRef(ObjCInterfaceDecl *Super,