[libclang] Slight changes to the indexing API and bigger internal changes for it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144577 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/libclang/Indexing.cpp b/tools/libclang/Indexing.cpp
index 8d90505..3332c65 100644
--- a/tools/libclang/Indexing.cpp
+++ b/tools/libclang/Indexing.cpp
@@ -381,46 +381,56 @@
   if (!DInfo)
     return 0;
 
-  if (clang_index_isEntityObjCContainerKind(DInfo->entityInfo->kind))
-    return &static_cast<const ObjCContainerDeclInfo*>(DInfo)->ObjCContDeclInfo;
+  const DeclInfo *DI = static_cast<const DeclInfo *>(DInfo);
+  if (const ObjCContainerDeclInfo *
+        ContInfo = dyn_cast<ObjCContainerDeclInfo>(DI))
+    return &ContInfo->ObjCContDeclInfo;
 
   return 0;
 }
 
 const CXIdxObjCInterfaceDeclInfo *
 clang_index_getObjCInterfaceDeclInfo(const CXIdxDeclInfo *DInfo) {
-  if (!DInfo || DInfo->entityInfo->kind != CXIdxEntity_ObjCClass)
+  if (!DInfo)
     return 0;
 
-  if (const CXIdxObjCContainerDeclInfo *
-        ContInfo = clang_index_getObjCContainerDeclInfo(DInfo)) {
-    if (ContInfo->kind == CXIdxObjCContainer_Interface)
-      return &static_cast<const ObjCInterfaceDeclInfo*>(DInfo)->ObjCInterDeclInfo;
-  }
-
-  return 0;
-}
-
-const CXIdxObjCProtocolDeclInfo *
-clang_index_getObjCProtocolDeclInfo(const CXIdxDeclInfo *DInfo) {
-  if (!DInfo || DInfo->entityInfo->kind != CXIdxEntity_ObjCProtocol)
-    return 0;
-
-  if (const CXIdxObjCContainerDeclInfo *
-        ContInfo = clang_index_getObjCContainerDeclInfo(DInfo)) {
-    if (ContInfo->kind == CXIdxObjCContainer_Interface)
-      return &static_cast<const ObjCProtocolDeclInfo*>(DInfo)->ObjCProtoDeclInfo;
-  }
+  const DeclInfo *DI = static_cast<const DeclInfo *>(DInfo);
+  if (const ObjCInterfaceDeclInfo *
+        InterInfo = dyn_cast<ObjCInterfaceDeclInfo>(DI))
+    return &InterInfo->ObjCInterDeclInfo;
 
   return 0;
 }
 
 const CXIdxObjCCategoryDeclInfo *
 clang_index_getObjCCategoryDeclInfo(const CXIdxDeclInfo *DInfo){
-  if (!DInfo || DInfo->entityInfo->kind != CXIdxEntity_ObjCCategory)
+  if (!DInfo)
     return 0;
 
-  return &static_cast<const ObjCCategoryDeclInfo*>(DInfo)->ObjCCatDeclInfo;
+  const DeclInfo *DI = static_cast<const DeclInfo *>(DInfo);
+  if (const ObjCCategoryDeclInfo *
+        CatInfo = dyn_cast<ObjCCategoryDeclInfo>(DI))
+    return &CatInfo->ObjCCatDeclInfo;
+
+  return 0;
+}
+
+const CXIdxObjCProtocolRefListInfo *
+clang_index_getObjCProtocolRefListInfo(const CXIdxDeclInfo *DInfo) {
+  if (!DInfo)
+    return 0;
+
+  const DeclInfo *DI = static_cast<const DeclInfo *>(DInfo);
+  
+  if (const ObjCInterfaceDeclInfo *
+        InterInfo = dyn_cast<ObjCInterfaceDeclInfo>(DI))
+    return InterInfo->ObjCInterDeclInfo.protocols;
+  
+  if (const ObjCProtocolDeclInfo *
+        ProtInfo = dyn_cast<ObjCProtocolDeclInfo>(DI))
+    return &ProtInfo->ObjCProtoRefListInfo;
+
+  return 0;
 }
 
 int clang_indexTranslationUnit(CXIndex CIdx,
diff --git a/tools/libclang/IndexingContext.cpp b/tools/libclang/IndexingContext.cpp
index d612a3b..24727fa 100644
--- a/tools/libclang/IndexingContext.cpp
+++ b/tools/libclang/IndexingContext.cpp
@@ -97,8 +97,6 @@
 
 void IndexingContext::handleDecl(const NamedDecl *D,
                                  SourceLocation Loc, CXCursor Cursor,
-                                 bool isRedeclaration, bool isDefinition,
-                                 bool isContainer,
                                  DeclInfo &DInfo) {
   if (!CB.indexDeclaration)
     return;
@@ -109,87 +107,69 @@
   DInfo.cursor = Cursor;
   DInfo.loc = getIndexLoc(Loc);
   DInfo.container = getIndexContainer(D);
-  DInfo.isRedeclaration = isRedeclaration;
-  DInfo.isDefinition = isDefinition;
+  DInfo.isImplicit = D->isImplicit();
 
   CXIdxClientContainer clientCont = 0;
-  CXIdxDeclOut DeclOut = { isContainer ? &clientCont : 0 };
+  CXIdxDeclOut DeclOut = { DInfo.isContainer ? &clientCont : 0 };
   CB.indexDeclaration(ClientData, &DInfo, &DeclOut);
 
-  if (isContainer)
+  if (DInfo.isContainer)
     addContainerInMap(cast<DeclContext>(D), clientCont);
 }
 
 void IndexingContext::handleObjCContainer(const ObjCContainerDecl *D,
                                           SourceLocation Loc, CXCursor Cursor,
-                                          bool isForwardRef,
-                                          bool isRedeclaration,
-                                          bool isImplementation,
                                           ObjCContainerDeclInfo &ContDInfo) {
   ContDInfo.ObjCContDeclInfo.declInfo = &ContDInfo;
-  if (isForwardRef)
-    ContDInfo.ObjCContDeclInfo.kind = CXIdxObjCContainer_ForwardRef;
-  else if (isImplementation)
-    ContDInfo.ObjCContDeclInfo.kind = CXIdxObjCContainer_Implementation;
-  else
-    ContDInfo.ObjCContDeclInfo.kind = CXIdxObjCContainer_Interface;
-
-  handleDecl(D, Loc, Cursor,
-             isRedeclaration, /*isDefinition=*/!isForwardRef,
-             /*isContainer=*/!isForwardRef, ContDInfo);
+  handleDecl(D, Loc, Cursor, ContDInfo);
 }
 
 void IndexingContext::handleFunction(const FunctionDecl *D) {
-  DeclInfo DInfo;
-  handleDecl(D, D->getLocation(), getCursor(D),
-             !D->isFirstDeclaration(), D->isThisDeclarationADefinition(),
-             D->isThisDeclarationADefinition(), DInfo);
+  DeclInfo DInfo(!D->isFirstDeclaration(), D->isThisDeclarationADefinition(),
+                 D->isThisDeclarationADefinition());
+  handleDecl(D, D->getLocation(), getCursor(D), DInfo);
 }
 
 void IndexingContext::handleVar(const VarDecl *D) {
-  DeclInfo DInfo;
-  handleDecl(D, D->getLocation(), getCursor(D),
-             !D->isFirstDeclaration(), D->isThisDeclarationADefinition(),
-             /*isContainer=*/false, DInfo);
+  DeclInfo DInfo(!D->isFirstDeclaration(), D->isThisDeclarationADefinition(),
+                 /*isContainer=*/false);
+  handleDecl(D, D->getLocation(), getCursor(D), DInfo);
 }
 
 void IndexingContext::handleField(const FieldDecl *D) {
-  DeclInfo DInfo;
-  handleDecl(D, D->getLocation(), getCursor(D),
-             /*isRedeclaration=*/false, /*isDefinition=*/true,
-             /*isContainer=*/false, DInfo);
+  DeclInfo DInfo(/*isRedeclaration=*/false, /*isDefinition=*/true,
+                 /*isContainer=*/false);
+  handleDecl(D, D->getLocation(), getCursor(D), DInfo);
 }
 
 void IndexingContext::handleEnumerator(const EnumConstantDecl *D) {
-  DeclInfo DInfo;
-  handleDecl(D, D->getLocation(), getCursor(D),
-             /*isRedeclaration=*/false, /*isDefinition=*/true,
-             /*isContainer=*/false, DInfo);
+  DeclInfo DInfo(/*isRedeclaration=*/false, /*isDefinition=*/true,
+                 /*isContainer=*/false);
+  handleDecl(D, D->getLocation(), getCursor(D), DInfo);
 }
 
 void IndexingContext::handleTagDecl(const TagDecl *D) {
-  DeclInfo DInfo;
-  handleDecl(D, D->getLocation(), getCursor(D),
-             !D->isFirstDeclaration(), D->isThisDeclarationADefinition(),
-             D->isThisDeclarationADefinition(), DInfo);
+  DeclInfo DInfo(!D->isFirstDeclaration(), D->isThisDeclarationADefinition(),
+                 D->isThisDeclarationADefinition());
+  handleDecl(D, D->getLocation(), getCursor(D), DInfo);
 }
 
 void IndexingContext::handleTypedef(const TypedefDecl *D) {
-  DeclInfo DInfo;
-  handleDecl(D, D->getLocation(), getCursor(D),
-             !D->isFirstDeclaration(), /*isDefinition=*/true,
-             /*isContainer=*/false, DInfo);
+  DeclInfo DInfo(!D->isFirstDeclaration(), /*isDefinition=*/true,
+                 /*isContainer=*/false);
+  handleDecl(D, D->getLocation(), getCursor(D), DInfo);
 }
 
 void IndexingContext::handleObjCClass(const ObjCClassDecl *D) {
-  ObjCContainerDeclInfo ContDInfo;
   const ObjCClassDecl::ObjCClassRef *Ref = D->getForwardDecl();
   ObjCInterfaceDecl *IFaceD = Ref->getInterface();
   SourceLocation Loc = Ref->getLocation();
   bool isRedeclaration = IFaceD->getLocation() != Loc;
+ 
+  ObjCContainerDeclInfo ContDInfo(/*isForwardRef=*/true, isRedeclaration,
+                                  /*isImplementation=*/false);
   handleObjCContainer(IFaceD, Loc, MakeCursorObjCClassRef(IFaceD, Loc, CXTU),
-                      /*isForwardRef=*/true, isRedeclaration,
-                      /*isImplementation=*/false, ContDInfo);
+                      ContDInfo);
 }
 
 void IndexingContext::handleObjCInterface(const ObjCInterfaceDecl *D) {
@@ -208,94 +188,77 @@
   
   ObjCProtocolListInfo ProtInfo(D->getReferencedProtocols(), *this, SA);
   
-  ObjCInterfaceDeclInfo InterInfo;
-  InterInfo.ObjCInterDeclInfo.declInfo = &InterInfo;
+  ObjCInterfaceDeclInfo InterInfo(D);
+  InterInfo.ObjCProtoListInfo = ProtInfo.getListInfo();
+  InterInfo.ObjCInterDeclInfo.containerInfo = &InterInfo.ObjCContDeclInfo;
   InterInfo.ObjCInterDeclInfo.superInfo = D->getSuperClass() ? &BaseClass : 0;
-  InterInfo.ObjCInterDeclInfo.protocols = ProtInfo.getProtocolRefs();
-  InterInfo.ObjCInterDeclInfo.numProtocols = ProtInfo.getNumProtocols();
+  InterInfo.ObjCInterDeclInfo.protocols = &InterInfo.ObjCProtoListInfo;
 
-  handleObjCContainer(D, D->getLocation(), getCursor(D),
-                      /*isForwardRef=*/false,
-                      /*isRedeclaration=*/D->isInitiallyForwardDecl(),
-                      /*isImplementation=*/false, InterInfo);
+  handleObjCContainer(D, D->getLocation(), getCursor(D), InterInfo);
 }
 
 void IndexingContext::handleObjCImplementation(
                                               const ObjCImplementationDecl *D) {
-  ObjCContainerDeclInfo ContDInfo;
   const ObjCInterfaceDecl *Class = D->getClassInterface();
-  handleObjCContainer(D, D->getLocation(), getCursor(D),
-                      /*isForwardRef=*/false,
+  ObjCContainerDeclInfo ContDInfo(/*isForwardRef=*/false,
                       /*isRedeclaration=*/!Class->isImplicitInterfaceDecl(),
-                      /*isImplementation=*/true, ContDInfo);
+                      /*isImplementation=*/true);
+  handleObjCContainer(D, D->getLocation(), getCursor(D), ContDInfo);
 }
 
 void IndexingContext::handleObjCForwardProtocol(const ObjCProtocolDecl *D,
                                                 SourceLocation Loc,
                                                 bool isRedeclaration) {
-  ObjCContainerDeclInfo ContDInfo;
+  ObjCContainerDeclInfo ContDInfo(/*isForwardRef=*/true,
+                                  isRedeclaration,
+                                  /*isImplementation=*/false);
   handleObjCContainer(D, Loc, MakeCursorObjCProtocolRef(D, Loc, CXTU),
-                      /*isForwardRef=*/true,
-                      isRedeclaration,
-                      /*isImplementation=*/false, ContDInfo);
+                      ContDInfo);
 }
 
 void IndexingContext::handleObjCProtocol(const ObjCProtocolDecl *D) {
   StrAdapter SA(*this);
   ObjCProtocolListInfo ProtListInfo(D->getReferencedProtocols(), *this, SA);
   
-  ObjCProtocolDeclInfo ProtInfo;
-  ProtInfo.ObjCProtoDeclInfo.declInfo = &ProtInfo;
-  ProtInfo.ObjCProtoDeclInfo.protocols = ProtListInfo.getProtocolRefs();
-  ProtInfo.ObjCProtoDeclInfo.numProtocols = ProtListInfo.getNumProtocols();
+  ObjCProtocolDeclInfo ProtInfo(D);
+  ProtInfo.ObjCProtoRefListInfo = ProtListInfo.getListInfo();
 
-  handleObjCContainer(D, D->getLocation(), getCursor(D),
-                      /*isForwardRef=*/false,
-                      /*isRedeclaration=*/D->isInitiallyForwardDecl(),
-                      /*isImplementation=*/false, ProtInfo);
+  handleObjCContainer(D, D->getLocation(), getCursor(D), ProtInfo);
 }
 
 void IndexingContext::handleObjCCategory(const ObjCCategoryDecl *D) {
-  ObjCCategoryDeclInfo CatDInfo;
+  ObjCCategoryDeclInfo CatDInfo(/*isImplementation=*/false);
   CXIdxEntityInfo ClassEntity;
   StrAdapter SA(*this);
   getEntityInfo(D->getClassInterface(), ClassEntity, SA);
 
   CatDInfo.ObjCCatDeclInfo.containerInfo = &CatDInfo.ObjCContDeclInfo;
   CatDInfo.ObjCCatDeclInfo.objcClass = &ClassEntity;
-  handleObjCContainer(D, D->getLocation(), getCursor(D),
-                      /*isForwardRef=*/false,
-                      /*isRedeclaration=*/false,
-                      /*isImplementation=*/false, CatDInfo);
+  handleObjCContainer(D, D->getLocation(), getCursor(D), CatDInfo);
 }
 
 void IndexingContext::handleObjCCategoryImpl(const ObjCCategoryImplDecl *D) {
   const ObjCCategoryDecl *CatD = D->getCategoryDecl();
-  ObjCCategoryDeclInfo CatDInfo;
+  ObjCCategoryDeclInfo CatDInfo(/*isImplementation=*/true);
   CXIdxEntityInfo ClassEntity;
   StrAdapter SA(*this);
   getEntityInfo(CatD->getClassInterface(), ClassEntity, SA);
 
   CatDInfo.ObjCCatDeclInfo.containerInfo = &CatDInfo.ObjCContDeclInfo;
   CatDInfo.ObjCCatDeclInfo.objcClass = &ClassEntity;
-  handleObjCContainer(D, D->getLocation(), getCursor(D),
-                      /*isForwardRef=*/false,
-                      /*isRedeclaration=*/true,
-                      /*isImplementation=*/true, CatDInfo);
+  handleObjCContainer(D, D->getLocation(), getCursor(D), CatDInfo);
 }
 
 void IndexingContext::handleObjCMethod(const ObjCMethodDecl *D) {
-  DeclInfo DInfo;
-  handleDecl(D, D->getLocation(), getCursor(D),
-             !D->isCanonicalDecl(), D->isThisDeclarationADefinition(),
-             D->isThisDeclarationADefinition(), DInfo);
+  DeclInfo DInfo(!D->isCanonicalDecl(), D->isThisDeclarationADefinition(),
+                 D->isThisDeclarationADefinition());
+  handleDecl(D, D->getLocation(), getCursor(D), DInfo);
 }
 
 void IndexingContext::handleObjCProperty(const ObjCPropertyDecl *D) {
-  DeclInfo DInfo;
-  handleDecl(D, D->getLocation(), getCursor(D),
-             /*isRedeclaration=*/false, /*isDefinition=*/false,
-             /*isContainer=*/false, DInfo);
+  DeclInfo DInfo(/*isRedeclaration=*/false, /*isDefinition=*/false,
+                 /*isContainer=*/false);
+  handleDecl(D, D->getLocation(), getCursor(D), DInfo);
 }
 
 void IndexingContext::handleReference(const NamedDecl *D, SourceLocation Loc,
@@ -490,7 +453,11 @@
     case Decl::ObjCCategory:
       EntityInfo.kind = CXIdxEntity_ObjCCategory; break;
     case Decl::ObjCMethod:
-      EntityInfo.kind = CXIdxEntity_ObjCMethod; break;
+      if (cast<ObjCMethodDecl>(D)->isInstanceMethod())
+        EntityInfo.kind = CXIdxEntity_ObjCInstanceMethod;
+      else
+        EntityInfo.kind = CXIdxEntity_ObjCClassMethod;
+      break;
     case Decl::ObjCProperty:
       EntityInfo.kind = CXIdxEntity_ObjCProperty; break;
     case Decl::ObjCIvar:
diff --git a/tools/libclang/IndexingContext.h b/tools/libclang/IndexingContext.h
index b367b72..c3e5f48 100644
--- a/tools/libclang/IndexingContext.h
+++ b/tools/libclang/IndexingContext.h
@@ -24,22 +24,113 @@
 
 struct DeclInfo : public CXIdxDeclInfo {
   CXIdxEntityInfo CXEntInfo;
+  enum DInfoKind {
+    Info_Decl,
+
+    Info_ObjCContainer,
+      Info_ObjCInterface,
+      Info_ObjCProtocol,
+      Info_ObjCCategory
+  };
+  
+  DInfoKind Kind;
+
+  DeclInfo(bool isRedeclaration, bool isDefinition, bool isContainer)
+    : Kind(Info_Decl) {
+    this->isRedeclaration = isRedeclaration;
+    this->isDefinition = isDefinition;
+    this->isContainer = isContainer;
+  }
+  DeclInfo(DInfoKind K,
+           bool isRedeclaration, bool isDefinition, bool isContainer)
+    : Kind(K) {
+    this->isRedeclaration = isRedeclaration;
+    this->isDefinition = isDefinition;
+    this->isContainer = isContainer;
+  }
+
+  static bool classof(const DeclInfo *) { return true; }
 };
 
 struct ObjCContainerDeclInfo : public DeclInfo {
   CXIdxObjCContainerDeclInfo ObjCContDeclInfo;
+
+  ObjCContainerDeclInfo(bool isForwardRef,
+                        bool isRedeclaration,
+                        bool isImplementation)
+    : DeclInfo(Info_ObjCContainer, isRedeclaration,
+               /*isDefinition=*/!isForwardRef, /*isContainer=*/!isForwardRef) {
+    init(isForwardRef, isImplementation);
+  }
+  ObjCContainerDeclInfo(DInfoKind K,
+                        bool isForwardRef,
+                        bool isRedeclaration,
+                        bool isImplementation)
+    : DeclInfo(K, isRedeclaration, /*isDefinition=*/!isForwardRef,
+               /*isContainer=*/!isForwardRef) {
+    init(isForwardRef, isImplementation);
+  }
+
+  static bool classof(const DeclInfo *D) {
+    return Info_ObjCContainer <= D->Kind && D->Kind <= Info_ObjCCategory;
+  }
+  static bool classof(const ObjCContainerDeclInfo *D) { return true; }
+
+private:
+  void init(bool isForwardRef, bool isImplementation) {
+    if (isForwardRef)
+      ObjCContDeclInfo.kind = CXIdxObjCContainer_ForwardRef;
+    else if (isImplementation)
+      ObjCContDeclInfo.kind = CXIdxObjCContainer_Implementation;
+    else
+      ObjCContDeclInfo.kind = CXIdxObjCContainer_Interface;
+  }
+};
+
+struct ObjCInterfaceDeclInfo : public ObjCContainerDeclInfo {
+  CXIdxObjCInterfaceDeclInfo ObjCInterDeclInfo;
+  CXIdxObjCProtocolRefListInfo ObjCProtoListInfo;
+
+  ObjCInterfaceDeclInfo(const ObjCInterfaceDecl *D)
+    : ObjCContainerDeclInfo(Info_ObjCInterface,
+                            /*isForwardRef=*/false,
+                            /*isRedeclaration=*/D->isInitiallyForwardDecl(),
+                            /*isImplementation=*/false) { }
+
+  static bool classof(const DeclInfo *D) {
+    return D->Kind == Info_ObjCInterface;
+  }
+  static bool classof(const ObjCInterfaceDeclInfo *D) { return true; }
+};
+
+struct ObjCProtocolDeclInfo : public ObjCContainerDeclInfo {
+  CXIdxObjCProtocolRefListInfo ObjCProtoRefListInfo;
+
+  ObjCProtocolDeclInfo(const ObjCProtocolDecl *D)
+    : ObjCContainerDeclInfo(Info_ObjCProtocol,
+                            /*isForwardRef=*/false,
+                            /*isRedeclaration=*/D->isInitiallyForwardDecl(),
+                            /*isImplementation=*/false) { }
+
+  static bool classof(const DeclInfo *D) {
+    return D->Kind == Info_ObjCProtocol;
+  }
+  static bool classof(const ObjCProtocolDeclInfo *D) { return true; }
 };
 
 struct ObjCCategoryDeclInfo : public ObjCContainerDeclInfo {
   CXIdxObjCCategoryDeclInfo ObjCCatDeclInfo;
-};
 
-struct ObjCInterfaceDeclInfo : public ObjCCategoryDeclInfo {
-  CXIdxObjCInterfaceDeclInfo ObjCInterDeclInfo;
-};
+  explicit ObjCCategoryDeclInfo(bool isImplementation)
+    : ObjCContainerDeclInfo(Info_ObjCCategory,
+                            /*isForwardRef=*/false,
+                            /*isRedeclaration=*/isImplementation,
+                            /*isImplementation=*/isImplementation) { }
 
-struct ObjCProtocolDeclInfo : public ObjCCategoryDeclInfo {
-  CXIdxObjCProtocolDeclInfo ObjCProtoDeclInfo;
+  static bool classof(const DeclInfo *D) {
+    return D->Kind == Info_ObjCCategory;
+  }
+  static bool classof(const ObjCCategoryDeclInfo *D) { return true; }
 };
 
 class IndexingContext {
@@ -92,8 +183,11 @@
     SmallVector<CXIdxEntityInfo, 4> ProtEntities;
     SmallVector<CXIdxObjCProtocolRefInfo *, 4> Prots;
 
-    CXIdxObjCProtocolRefInfo **getProtocolRefs() { return Prots.data(); }
-    unsigned getNumProtocols() { return (unsigned)Prots.size(); }
+    CXIdxObjCProtocolRefListInfo getListInfo() {
+      CXIdxObjCProtocolRefListInfo Info = { Prots.data(),
+                                            (unsigned)Prots.size() };
+      return Info;
+    }
 
     ObjCProtocolListInfo(const ObjCProtocolList &ProtList,
                          IndexingContext &IdxCtx,
@@ -184,14 +278,10 @@
 private:
   void handleDecl(const NamedDecl *D,
                   SourceLocation Loc, CXCursor Cursor,
-                  bool isRedeclaration, bool isDefinition, bool isContainer,
                   DeclInfo &DInfo);
 
   void handleObjCContainer(const ObjCContainerDecl *D,
                            SourceLocation Loc, CXCursor Cursor,
-                           bool isForwardRef,
-                           bool isRedeclaration,
-                           bool isImplementation,
                            ObjCContainerDeclInfo &ContDInfo);
 
   void addContainerInMap(const DeclContext *DC, CXIdxClientContainer container);
diff --git a/tools/libclang/libclang.exports b/tools/libclang/libclang.exports
index 4596336..93cfb47 100644
--- a/tools/libclang/libclang.exports
+++ b/tools/libclang/libclang.exports
@@ -138,7 +138,7 @@
 clang_index_getObjCCategoryDeclInfo
 clang_index_getObjCContainerDeclInfo
 clang_index_getObjCInterfaceDeclInfo
-clang_index_getObjCProtocolDeclInfo
+clang_index_getObjCProtocolRefListInfo
 clang_index_isEntityObjCContainerKind
 clang_indexLoc_getCXSourceLocation
 clang_indexLoc_getFileLocation