[PATCH] libclang.dll compat with Borland compilers

Stephen Fewer stephen_fewer at harmonysecurity.com
Wed Oct 15 15:23:31 PDT 2014


Hi,

This patch adds compatibility for using libclang.dll built with MSVC in
Borland compiled code (C++ Builder). The 32bit Borland compiler returns
structures > 4 bytes and < 9 bytes using a different ABI than MSVC
emits, so to workaround this you must use a Borland specific keyword
__msreturn as the calling convention [0].

The patch adds a define CINDEX_CC to
.\tools\clang\include\clang-c\Platform.h, when using a Borland compiler,
in order to specify __msreturn and then applies CINDEX_CC to all
functions in the clang-c headers. Should have no effect for any other
compiler.

Regards,

- Stephen.

[0] http://docwiki.embarcadero.com/RADStudio/XE7/en/Msreturn
-------------- next part --------------
Index: BuildSystem.h
===================================================================
--- BuildSystem.h	(revision 219844)
+++ BuildSystem.h	(working copy)
@@ -31,13 +31,13 @@
  * \brief Return the timestamp for use with Clang's
  * \c -fbuild-session-timestamp= option.
  */
-CINDEX_LINKAGE unsigned long long clang_getBuildSessionTimestamp(void);
+CINDEX_LINKAGE unsigned long long CINDEX_CC clang_getBuildSessionTimestamp(void);
 
 /**
  * \brief Object encapsulating information about overlaying virtual
  * file/directories over the real file system.
  */
-typedef struct CXVirtualFileOverlayImpl *CXVirtualFileOverlay;
+typedef struct CXVirtualFileOverlayImpl * CINDEX_CC CXVirtualFileOverlay;
 
 /**
  * \brief Create a \c CXVirtualFileOverlay object.
@@ -46,7 +46,7 @@
  * \param options is reserved, always pass 0.
  */
 CINDEX_LINKAGE CXVirtualFileOverlay
-clang_VirtualFileOverlay_create(unsigned options);
+CINDEX_CC clang_VirtualFileOverlay_create(unsigned options);
 
 /**
  * \brief Map an absolute virtual file path to an absolute real one.
@@ -54,7 +54,7 @@
  * \returns 0 for success, non-zero to indicate an error.
  */
 CINDEX_LINKAGE enum CXErrorCode
-clang_VirtualFileOverlay_addFileMapping(CXVirtualFileOverlay,
+CINDEX_CC clang_VirtualFileOverlay_addFileMapping(CXVirtualFileOverlay,
                                         const char *virtualPath,
                                         const char *realPath);
 
@@ -65,7 +65,7 @@
  * \returns 0 for success, non-zero to indicate an error.
  */
 CINDEX_LINKAGE enum CXErrorCode
-clang_VirtualFileOverlay_setCaseSensitivity(CXVirtualFileOverlay,
+CINDEX_CC clang_VirtualFileOverlay_setCaseSensitivity(CXVirtualFileOverlay,
 											int caseSensitive);
 
 /**
@@ -78,14 +78,14 @@
  * \returns 0 for success, non-zero to indicate an error.
  */
 CINDEX_LINKAGE enum CXErrorCode
-clang_VirtualFileOverlay_writeToBuffer(CXVirtualFileOverlay, unsigned options,
+CINDEX_CC clang_VirtualFileOverlay_writeToBuffer(CXVirtualFileOverlay, unsigned options,
                                        char **out_buffer_ptr,
                                        unsigned *out_buffer_size);
 
 /**
  * \brief Dispose a \c CXVirtualFileOverlay object.
  */
-CINDEX_LINKAGE void clang_VirtualFileOverlay_dispose(CXVirtualFileOverlay);
+CINDEX_LINKAGE void CINDEX_CC clang_VirtualFileOverlay_dispose(CXVirtualFileOverlay);
 
 /**
  * \brief Object encapsulating information about a module.map file.
@@ -99,14 +99,14 @@
  * \param options is reserved, always pass 0.
  */
 CINDEX_LINKAGE CXModuleMapDescriptor
-clang_ModuleMapDescriptor_create(unsigned options);
+CINDEX_CC clang_ModuleMapDescriptor_create(unsigned options);
 
 /**
  * \brief Sets the framework module name that the module.map describes.
  * \returns 0 for success, non-zero to indicate an error.
  */
 CINDEX_LINKAGE enum CXErrorCode
-clang_ModuleMapDescriptor_setFrameworkModuleName(CXModuleMapDescriptor,
+CINDEX_CC clang_ModuleMapDescriptor_setFrameworkModuleName(CXModuleMapDescriptor,
                                                  const char *name);
 
 /**
@@ -114,7 +114,7 @@
  * \returns 0 for success, non-zero to indicate an error.
  */
 CINDEX_LINKAGE enum CXErrorCode
-clang_ModuleMapDescriptor_setUmbrellaHeader(CXModuleMapDescriptor,
+CINDEX_CC clang_ModuleMapDescriptor_setUmbrellaHeader(CXModuleMapDescriptor,
                                             const char *name);
 
 /**
@@ -127,14 +127,14 @@
  * \returns 0 for success, non-zero to indicate an error.
  */
 CINDEX_LINKAGE enum CXErrorCode
-clang_ModuleMapDescriptor_writeToBuffer(CXModuleMapDescriptor, unsigned options,
+CINDEX_CC clang_ModuleMapDescriptor_writeToBuffer(CXModuleMapDescriptor, unsigned options,
                                        char **out_buffer_ptr,
                                        unsigned *out_buffer_size);
 
 /**
  * \brief Dispose a \c CXModuleMapDescriptor object.
  */
-CINDEX_LINKAGE void clang_ModuleMapDescriptor_dispose(CXModuleMapDescriptor);
+CINDEX_LINKAGE void CINDEX_CC clang_ModuleMapDescriptor_dispose(CXModuleMapDescriptor);
 
 /**
  * @}
Index: CXCompilationDatabase.h
===================================================================
--- CXCompilationDatabase.h	(revision 219844)
+++ CXCompilationDatabase.h	(working copy)
@@ -77,39 +77,39 @@
  * It must be freed by \c clang_CompilationDatabase_dispose.
  */
 CINDEX_LINKAGE CXCompilationDatabase
-clang_CompilationDatabase_fromDirectory(const char *BuildDir,
+CINDEX_CC clang_CompilationDatabase_fromDirectory(const char *BuildDir,
                                         CXCompilationDatabase_Error *ErrorCode);
 
 /**
  * \brief Free the given compilation database
  */
 CINDEX_LINKAGE void
-clang_CompilationDatabase_dispose(CXCompilationDatabase);
+CINDEX_CC clang_CompilationDatabase_dispose(CXCompilationDatabase);
 
 /**
  * \brief Find the compile commands used for a file. The compile commands
  * must be freed by \c clang_CompileCommands_dispose.
  */
 CINDEX_LINKAGE CXCompileCommands
-clang_CompilationDatabase_getCompileCommands(CXCompilationDatabase,
+CINDEX_CC clang_CompilationDatabase_getCompileCommands(CXCompilationDatabase,
                                              const char *CompleteFileName);
 
 /**
  * \brief Get all the compile commands in the given compilation database.
  */
 CINDEX_LINKAGE CXCompileCommands
-clang_CompilationDatabase_getAllCompileCommands(CXCompilationDatabase);
+CINDEX_CC clang_CompilationDatabase_getAllCompileCommands(CXCompilationDatabase);
 
 /**
  * \brief Free the given CompileCommands
  */
-CINDEX_LINKAGE void clang_CompileCommands_dispose(CXCompileCommands);
+CINDEX_LINKAGE void CINDEX_CC clang_CompileCommands_dispose(CXCompileCommands);
 
 /**
  * \brief Get the number of CompileCommand we have for a file
  */
 CINDEX_LINKAGE unsigned
-clang_CompileCommands_getSize(CXCompileCommands);
+CINDEX_CC clang_CompileCommands_getSize(CXCompileCommands);
 
 /**
  * \brief Get the I'th CompileCommand for a file
@@ -117,20 +117,20 @@
  * Note : 0 <= i < clang_CompileCommands_getSize(CXCompileCommands)
  */
 CINDEX_LINKAGE CXCompileCommand
-clang_CompileCommands_getCommand(CXCompileCommands, unsigned I);
+CINDEX_CC clang_CompileCommands_getCommand(CXCompileCommands, unsigned I);
 
 /**
  * \brief Get the working directory where the CompileCommand was executed from
  */
 CINDEX_LINKAGE CXString
-clang_CompileCommand_getDirectory(CXCompileCommand);
+CINDEX_CC clang_CompileCommand_getDirectory(CXCompileCommand);
 
 /**
  * \brief Get the number of arguments in the compiler invocation.
  *
  */
 CINDEX_LINKAGE unsigned
-clang_CompileCommand_getNumArgs(CXCompileCommand);
+CINDEX_CC clang_CompileCommand_getNumArgs(CXCompileCommand);
 
 /**
  * \brief Get the I'th argument value in the compiler invocations
@@ -139,25 +139,25 @@
  *  - argument 0 is the compiler executable
  */
 CINDEX_LINKAGE CXString
-clang_CompileCommand_getArg(CXCompileCommand, unsigned I);
+CINDEX_CC clang_CompileCommand_getArg(CXCompileCommand, unsigned I);
 
 /**
  * \brief Get the number of source mappings for the compiler invocation.
  */
 CINDEX_LINKAGE unsigned
-clang_CompileCommand_getNumMappedSources(CXCompileCommand);
+CINDEX_CC clang_CompileCommand_getNumMappedSources(CXCompileCommand);
 
 /**
  * \brief Get the I'th mapped source path for the compiler invocation.
  */
 CINDEX_LINKAGE CXString
-clang_CompileCommand_getMappedSourcePath(CXCompileCommand, unsigned I);
+CINDEX_CC clang_CompileCommand_getMappedSourcePath(CXCompileCommand, unsigned I);
 
 /**
  * \brief Get the I'th mapped source content for the compiler invocation.
  */
 CINDEX_LINKAGE CXString
-clang_CompileCommand_getMappedSourceContent(CXCompileCommand, unsigned I);
+CINDEX_CC clang_CompileCommand_getMappedSourceContent(CXCompileCommand, unsigned I);
 
 /**
  * @}
Index: CXString.h
===================================================================
--- CXString.h	(revision 219844)
+++ CXString.h	(working copy)
@@ -43,12 +43,12 @@
 /**
  * \brief Retrieve the character data associated with the given string.
  */
-CINDEX_LINKAGE const char *clang_getCString(CXString string);
+CINDEX_LINKAGE const char * CINDEX_CC clang_getCString(CXString string);
 
 /**
  * \brief Free the given string.
  */
-CINDEX_LINKAGE void clang_disposeString(CXString string);
+CINDEX_LINKAGE void CINDEX_CC clang_disposeString(CXString string);
 
 /**
  * @}
Index: Documentation.h
===================================================================
--- Documentation.h	(revision 219844)
+++ Documentation.h	(working copy)
@@ -44,7 +44,7 @@
  * declaration), return the associated parsed comment as a
  * \c CXComment_FullComment AST node.
  */
-CINDEX_LINKAGE CXComment clang_Cursor_getParsedComment(CXCursor C);
+CINDEX_LINKAGE CXComment CINDEX_CC clang_Cursor_getParsedComment(CXCursor C);
 
 /**
  * \brief Describes the type of the comment AST node (\c CXComment).  A comment
@@ -210,14 +210,14 @@
  *
  * \returns the type of the AST node.
  */
-CINDEX_LINKAGE enum CXCommentKind clang_Comment_getKind(CXComment Comment);
+CINDEX_LINKAGE enum CXCommentKind CINDEX_CC clang_Comment_getKind(CXComment Comment);
 
 /**
  * \param Comment AST node of any kind.
  *
  * \returns number of children of the AST node.
  */
-CINDEX_LINKAGE unsigned clang_Comment_getNumChildren(CXComment Comment);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_Comment_getNumChildren(CXComment Comment);
 
 /**
  * \param Comment AST node of any kind.
@@ -227,7 +227,7 @@
  * \returns the specified child of the AST node.
  */
 CINDEX_LINKAGE
-CXComment clang_Comment_getChild(CXComment Comment, unsigned ChildIdx);
+CXComment CINDEX_CC clang_Comment_getChild(CXComment Comment, unsigned ChildIdx);
 
 /**
  * \brief A \c CXComment_Paragraph node is considered whitespace if it contains
@@ -238,7 +238,7 @@
  *
  * \returns non-zero if \c Comment is whitespace.
  */
-CINDEX_LINKAGE unsigned clang_Comment_isWhitespace(CXComment Comment);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_Comment_isWhitespace(CXComment Comment);
 
 /**
  * \returns non-zero if \c Comment is inline content and has a newline
@@ -246,7 +246,7 @@
  * do not count.
  */
 CINDEX_LINKAGE
-unsigned clang_InlineContentComment_hasTrailingNewline(CXComment Comment);
+unsigned CINDEX_CC clang_InlineContentComment_hasTrailingNewline(CXComment Comment);
 
 /**
  * \param Comment a \c CXComment_Text AST node.
@@ -261,7 +261,7 @@
  * \returns name of the inline command.
  */
 CINDEX_LINKAGE
-CXString clang_InlineCommandComment_getCommandName(CXComment Comment);
+CXString CINDEX_CC clang_InlineCommandComment_getCommandName(CXComment Comment);
 
 /**
  * \param Comment a \c CXComment_InlineCommand AST node.
@@ -270,7 +270,7 @@
  * semantics in Doxygen.
  */
 CINDEX_LINKAGE enum CXCommentInlineCommandRenderKind
-clang_InlineCommandComment_getRenderKind(CXComment Comment);
+CINDEX_CC clang_InlineCommandComment_getRenderKind(CXComment Comment);
 
 /**
  * \param Comment a \c CXComment_InlineCommand AST node.
@@ -278,7 +278,7 @@
  * \returns number of command arguments.
  */
 CINDEX_LINKAGE
-unsigned clang_InlineCommandComment_getNumArgs(CXComment Comment);
+unsigned CINDEX_CC clang_InlineCommandComment_getNumArgs(CXComment Comment);
 
 /**
  * \param Comment a \c CXComment_InlineCommand AST node.
@@ -288,7 +288,7 @@
  * \returns text of the specified argument.
  */
 CINDEX_LINKAGE
-CXString clang_InlineCommandComment_getArgText(CXComment Comment,
+CXString CINDEX_CC clang_InlineCommandComment_getArgText(CXComment Comment,
                                                unsigned ArgIdx);
 
 /**
@@ -297,7 +297,7 @@
  *
  * \returns HTML tag name.
  */
-CINDEX_LINKAGE CXString clang_HTMLTagComment_getTagName(CXComment Comment);
+CINDEX_LINKAGE CXString CINDEX_CC clang_HTMLTagComment_getTagName(CXComment Comment);
 
 /**
  * \param Comment a \c CXComment_HTMLStartTag AST node.
@@ -305,14 +305,14 @@
  * \returns non-zero if tag is self-closing (for example, <br />).
  */
 CINDEX_LINKAGE
-unsigned clang_HTMLStartTagComment_isSelfClosing(CXComment Comment);
+unsigned CINDEX_CC clang_HTMLStartTagComment_isSelfClosing(CXComment Comment);
 
 /**
  * \param Comment a \c CXComment_HTMLStartTag AST node.
  *
  * \returns number of attributes (name-value pairs) attached to the start tag.
  */
-CINDEX_LINKAGE unsigned clang_HTMLStartTag_getNumAttrs(CXComment Comment);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_HTMLStartTag_getNumAttrs(CXComment Comment);
 
 /**
  * \param Comment a \c CXComment_HTMLStartTag AST node.
@@ -322,7 +322,7 @@
  * \returns name of the specified attribute.
  */
 CINDEX_LINKAGE
-CXString clang_HTMLStartTag_getAttrName(CXComment Comment, unsigned AttrIdx);
+CXString CINDEX_CC clang_HTMLStartTag_getAttrName(CXComment Comment, unsigned AttrIdx);
 
 /**
  * \param Comment a \c CXComment_HTMLStartTag AST node.
@@ -332,7 +332,7 @@
  * \returns value of the specified attribute.
  */
 CINDEX_LINKAGE
-CXString clang_HTMLStartTag_getAttrValue(CXComment Comment, unsigned AttrIdx);
+CXString CINDEX_CC clang_HTMLStartTag_getAttrValue(CXComment Comment, unsigned AttrIdx);
 
 /**
  * \param Comment a \c CXComment_BlockCommand AST node.
@@ -340,7 +340,7 @@
  * \returns name of the block command.
  */
 CINDEX_LINKAGE
-CXString clang_BlockCommandComment_getCommandName(CXComment Comment);
+CXString CINDEX_CC clang_BlockCommandComment_getCommandName(CXComment Comment);
 
 /**
  * \param Comment a \c CXComment_BlockCommand AST node.
@@ -348,7 +348,7 @@
  * \returns number of word-like arguments.
  */
 CINDEX_LINKAGE
-unsigned clang_BlockCommandComment_getNumArgs(CXComment Comment);
+unsigned CINDEX_CC clang_BlockCommandComment_getNumArgs(CXComment Comment);
 
 /**
  * \param Comment a \c CXComment_BlockCommand AST node.
@@ -358,7 +358,7 @@
  * \returns text of the specified word-like argument.
  */
 CINDEX_LINKAGE
-CXString clang_BlockCommandComment_getArgText(CXComment Comment,
+CXString CINDEX_CC clang_BlockCommandComment_getArgText(CXComment Comment,
                                               unsigned ArgIdx);
 
 /**
@@ -368,7 +368,7 @@
  * \returns paragraph argument of the block command.
  */
 CINDEX_LINKAGE
-CXComment clang_BlockCommandComment_getParagraph(CXComment Comment);
+CXComment CINDEX_CC clang_BlockCommandComment_getParagraph(CXComment Comment);
 
 /**
  * \param Comment a \c CXComment_ParamCommand AST node.
@@ -376,7 +376,7 @@
  * \returns parameter name.
  */
 CINDEX_LINKAGE
-CXString clang_ParamCommandComment_getParamName(CXComment Comment);
+CXString CINDEX_CC clang_ParamCommandComment_getParamName(CXComment Comment);
 
 /**
  * \param Comment a \c CXComment_ParamCommand AST node.
@@ -386,7 +386,7 @@
  * function will return a meaningful value.
  */
 CINDEX_LINKAGE
-unsigned clang_ParamCommandComment_isParamIndexValid(CXComment Comment);
+unsigned CINDEX_CC clang_ParamCommandComment_isParamIndexValid(CXComment Comment);
 
 /**
  * \param Comment a \c CXComment_ParamCommand AST node.
@@ -394,7 +394,7 @@
  * \returns zero-based parameter index in function prototype.
  */
 CINDEX_LINKAGE
-unsigned clang_ParamCommandComment_getParamIndex(CXComment Comment);
+unsigned CINDEX_CC clang_ParamCommandComment_getParamIndex(CXComment Comment);
 
 /**
  * \param Comment a \c CXComment_ParamCommand AST node.
@@ -403,7 +403,7 @@
  * the comment.
  */
 CINDEX_LINKAGE
-unsigned clang_ParamCommandComment_isDirectionExplicit(CXComment Comment);
+unsigned CINDEX_CC clang_ParamCommandComment_isDirectionExplicit(CXComment Comment);
 
 /**
  * \param Comment a \c CXComment_ParamCommand AST node.
@@ -411,7 +411,7 @@
  * \returns parameter passing direction.
  */
 CINDEX_LINKAGE
-enum CXCommentParamPassDirection clang_ParamCommandComment_getDirection(
+enum CXCommentParamPassDirection CINDEX_CC clang_ParamCommandComment_getDirection(
                                                             CXComment Comment);
 
 /**
@@ -420,7 +420,7 @@
  * \returns template parameter name.
  */
 CINDEX_LINKAGE
-CXString clang_TParamCommandComment_getParamName(CXComment Comment);
+CXString CINDEX_CC clang_TParamCommandComment_getParamName(CXComment Comment);
 
 /**
  * \param Comment a \c CXComment_TParamCommand AST node.
@@ -432,7 +432,7 @@
  * value.
  */
 CINDEX_LINKAGE
-unsigned clang_TParamCommandComment_isParamPositionValid(CXComment Comment);
+unsigned CINDEX_CC clang_TParamCommandComment_isParamPositionValid(CXComment Comment);
 
 /**
  * \param Comment a \c CXComment_TParamCommand AST node.
@@ -448,7 +448,7 @@
  * for T nesting depth is 1.
  */
 CINDEX_LINKAGE
-unsigned clang_TParamCommandComment_getDepth(CXComment Comment);
+unsigned CINDEX_CC clang_TParamCommandComment_getDepth(CXComment Comment);
 
 /**
  * \param Comment a \c CXComment_TParamCommand AST node.
@@ -469,7 +469,7 @@
  * at depth 1 T's index is 0.
  */
 CINDEX_LINKAGE
-unsigned clang_TParamCommandComment_getIndex(CXComment Comment, unsigned Depth);
+unsigned CINDEX_CC clang_TParamCommandComment_getIndex(CXComment Comment, unsigned Depth);
 
 /**
  * \param Comment a \c CXComment_VerbatimBlockLine AST node.
@@ -477,14 +477,14 @@
  * \returns text contained in the AST node.
  */
 CINDEX_LINKAGE
-CXString clang_VerbatimBlockLineComment_getText(CXComment Comment);
+CXString CINDEX_CC clang_VerbatimBlockLineComment_getText(CXComment Comment);
 
 /**
  * \param Comment a \c CXComment_VerbatimLine AST node.
  *
  * \returns text contained in the AST node.
  */
-CINDEX_LINKAGE CXString clang_VerbatimLineComment_getText(CXComment Comment);
+CINDEX_LINKAGE CXString CINDEX_CC clang_VerbatimLineComment_getText(CXComment Comment);
 
 /**
  * \brief Convert an HTML tag AST node to string.
@@ -494,7 +494,7 @@
  *
  * \returns string containing an HTML tag.
  */
-CINDEX_LINKAGE CXString clang_HTMLTagComment_getAsString(CXComment Comment);
+CINDEX_LINKAGE CXString CINDEX_CC clang_HTMLTagComment_getAsString(CXComment Comment);
 
 /**
  * \brief Convert a given full parsed comment to an HTML fragment.
@@ -527,7 +527,7 @@
  *
  * \returns string containing an HTML fragment.
  */
-CINDEX_LINKAGE CXString clang_FullComment_getAsHTML(CXComment Comment);
+CINDEX_LINKAGE CXString CINDEX_CC clang_FullComment_getAsHTML(CXComment Comment);
 
 /**
  * \brief Convert a given full parsed comment to an XML document.
@@ -539,7 +539,7 @@
  *
  * \returns string containing an XML document.
  */
-CINDEX_LINKAGE CXString clang_FullComment_getAsXML(CXComment Comment);
+CINDEX_LINKAGE CXString CINDEX_CC clang_FullComment_getAsXML(CXComment Comment);
 
 /**
  * @}
Index: Index.h
===================================================================
--- Index.h	(revision 219844)
+++ Index.h	(working copy)
@@ -206,7 +206,7 @@
  * -include-pch) allows 'excludeDeclsFromPCH' to remove redundant callbacks
  * (which gives the indexer the same performance benefit as the compiler).
  */
-CINDEX_LINKAGE CXIndex clang_createIndex(int excludeDeclarationsFromPCH,
+CINDEX_LINKAGE CXIndex CINDEX_CC clang_createIndex(int excludeDeclarationsFromPCH,
                                          int displayDiagnostics);
 
 /**
@@ -215,7 +215,7 @@
  * The index must not be destroyed until all of the translation units created
  * within that index have been destroyed.
  */
-CINDEX_LINKAGE void clang_disposeIndex(CXIndex index);
+CINDEX_LINKAGE void CINDEX_CC clang_disposeIndex(CXIndex index);
 
 typedef enum {
   /**
@@ -264,7 +264,7 @@
  *
  * \param options A bitmask of options, a bitwise OR of CXGlobalOpt_XXX flags.
  */
-CINDEX_LINKAGE void clang_CXIndex_setGlobalOptions(CXIndex, unsigned options);
+CINDEX_LINKAGE void CINDEX_CC clang_CXIndex_setGlobalOptions(CXIndex, unsigned options);
 
 /**
  * \brief Gets the general options associated with a CXIndex.
@@ -272,7 +272,7 @@
  * \returns A bitmask of options, a bitwise OR of CXGlobalOpt_XXX flags that
  * are associated with the given CXIndex object.
  */
-CINDEX_LINKAGE unsigned clang_CXIndex_getGlobalOptions(CXIndex);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_CXIndex_getGlobalOptions(CXIndex);
 
 /**
  * \defgroup CINDEX_FILES File manipulation routines
@@ -289,12 +289,12 @@
 /**
  * \brief Retrieve the complete file and path name of the given file.
  */
-CINDEX_LINKAGE CXString clang_getFileName(CXFile SFile);
+CINDEX_LINKAGE CXString CINDEX_CC clang_getFileName(CXFile SFile);
 
 /**
  * \brief Retrieve the last modification time of the given file.
  */
-CINDEX_LINKAGE time_t clang_getFileTime(CXFile SFile);
+CINDEX_LINKAGE time_t CINDEX_CC clang_getFileTime(CXFile SFile);
 
 /**
  * \brief Uniquely identifies a CXFile, that refers to the same underlying file,
@@ -312,7 +312,7 @@
  * \returns If there was a failure getting the unique ID, returns non-zero,
  * otherwise returns 0.
 */
-CINDEX_LINKAGE int clang_getFileUniqueID(CXFile file, CXFileUniqueID *outID);
+CINDEX_LINKAGE int CINDEX_CC clang_getFileUniqueID(CXFile file, CXFileUniqueID *outID);
 
 /**
  * \brief Determine whether the given header is guarded against
@@ -320,7 +320,7 @@
  * \#ifndef/\#define/\#endif macro guards or with \#pragma once.
  */
 CINDEX_LINKAGE unsigned 
-clang_isFileMultipleIncludeGuarded(CXTranslationUnit tu, CXFile file);
+CINDEX_CC clang_isFileMultipleIncludeGuarded(CXTranslationUnit tu, CXFile file);
 
 /**
  * \brief Retrieve a file handle within the given translation unit.
@@ -332,14 +332,14 @@
  * \returns the file handle for the named file in the translation unit \p tu,
  * or a NULL file handle if the file was not a part of this translation unit.
  */
-CINDEX_LINKAGE CXFile clang_getFile(CXTranslationUnit tu,
+CINDEX_LINKAGE CXFile CINDEX_CC clang_getFile(CXTranslationUnit tu,
                                     const char *file_name);
 
 /**
  * \brief Returns non-zero if the \c file1 and \c file2 point to the same file,
  * or they are both NULL.
  */
-CINDEX_LINKAGE int clang_File_isEqual(CXFile file1, CXFile file2);
+CINDEX_LINKAGE int CINDEX_CC clang_File_isEqual(CXFile file1, CXFile file2);
 
 /**
  * @}
@@ -385,7 +385,7 @@
 /**
  * \brief Retrieve a NULL (invalid) source location.
  */
-CINDEX_LINKAGE CXSourceLocation clang_getNullLocation(void);
+CINDEX_LINKAGE CXSourceLocation CINDEX_CC clang_getNullLocation(void);
 
 /**
  * \brief Determine whether two source locations, which must refer into
@@ -395,14 +395,14 @@
  * \returns non-zero if the source locations refer to the same location, zero
  * if they refer to different locations.
  */
-CINDEX_LINKAGE unsigned clang_equalLocations(CXSourceLocation loc1,
+CINDEX_LINKAGE unsigned CINDEX_CC clang_equalLocations(CXSourceLocation loc1,
                                              CXSourceLocation loc2);
 
 /**
  * \brief Retrieves the source location associated with a given file/line/column
  * in a particular translation unit.
  */
-CINDEX_LINKAGE CXSourceLocation clang_getLocation(CXTranslationUnit tu,
+CINDEX_LINKAGE CXSourceLocation CINDEX_CC clang_getLocation(CXTranslationUnit tu,
                                                   CXFile file,
                                                   unsigned line,
                                                   unsigned column);
@@ -410,31 +410,31 @@
  * \brief Retrieves the source location associated with a given character offset
  * in a particular translation unit.
  */
-CINDEX_LINKAGE CXSourceLocation clang_getLocationForOffset(CXTranslationUnit tu,
+CINDEX_LINKAGE CXSourceLocation CINDEX_CC clang_getLocationForOffset(CXTranslationUnit tu,
                                                            CXFile file,
                                                            unsigned offset);
 
 /**
  * \brief Returns non-zero if the given source location is in a system header.
  */
-CINDEX_LINKAGE int clang_Location_isInSystemHeader(CXSourceLocation location);
+CINDEX_LINKAGE int CINDEX_CC clang_Location_isInSystemHeader(CXSourceLocation location);
 
 /**
  * \brief Returns non-zero if the given source location is in the main file of
  * the corresponding translation unit.
  */
-CINDEX_LINKAGE int clang_Location_isFromMainFile(CXSourceLocation location);
+CINDEX_LINKAGE int CINDEX_CC clang_Location_isFromMainFile(CXSourceLocation location);
 
 /**
  * \brief Retrieve a NULL (invalid) source range.
  */
-CINDEX_LINKAGE CXSourceRange clang_getNullRange(void);
+CINDEX_LINKAGE CXSourceRange CINDEX_CC clang_getNullRange(void);
 
 /**
  * \brief Retrieve a source range given the beginning and ending source
  * locations.
  */
-CINDEX_LINKAGE CXSourceRange clang_getRange(CXSourceLocation begin,
+CINDEX_LINKAGE CXSourceRange CINDEX_CC clang_getRange(CXSourceLocation begin,
                                             CXSourceLocation end);
 
 /**
@@ -442,13 +442,13 @@
  *
  * \returns non-zero if the ranges are the same, zero if they differ.
  */
-CINDEX_LINKAGE unsigned clang_equalRanges(CXSourceRange range1,
+CINDEX_LINKAGE unsigned CINDEX_CC clang_equalRanges(CXSourceRange range1,
                                           CXSourceRange range2);
 
 /**
  * \brief Returns non-zero if \p range is null.
  */
-CINDEX_LINKAGE int clang_Range_isNull(CXSourceRange range);
+CINDEX_LINKAGE int CINDEX_CC clang_Range_isNull(CXSourceRange range);
 
 /**
  * \brief Retrieve the file, line, column, and offset represented by
@@ -472,7 +472,7 @@
  * \param offset [out] if non-NULL, will be set to the offset into the
  * buffer to which the given source location points.
  */
-CINDEX_LINKAGE void clang_getExpansionLocation(CXSourceLocation location,
+CINDEX_LINKAGE void CINDEX_CC clang_getExpansionLocation(CXSourceLocation location,
                                                CXFile *file,
                                                unsigned *line,
                                                unsigned *column,
@@ -518,7 +518,7 @@
  * \param column [out] if non-NULL, will be set to the column number of the
  * source location. For an invalid source location, zero is returned.
  */
-CINDEX_LINKAGE void clang_getPresumedLocation(CXSourceLocation location,
+CINDEX_LINKAGE void CINDEX_CC clang_getPresumedLocation(CXSourceLocation location,
                                               CXString *filename,
                                               unsigned *line,
                                               unsigned *column);
@@ -531,7 +531,7 @@
  * #clang_getExpansionLocation(). See that interface's documentation for
  * details.
  */
-CINDEX_LINKAGE void clang_getInstantiationLocation(CXSourceLocation location,
+CINDEX_LINKAGE void CINDEX_CC clang_getInstantiationLocation(CXSourceLocation location,
                                                    CXFile *file,
                                                    unsigned *line,
                                                    unsigned *column,
@@ -559,7 +559,7 @@
  * \param offset [out] if non-NULL, will be set to the offset into the
  * buffer to which the given source location points.
  */
-CINDEX_LINKAGE void clang_getSpellingLocation(CXSourceLocation location,
+CINDEX_LINKAGE void CINDEX_CC clang_getSpellingLocation(CXSourceLocation location,
                                               CXFile *file,
                                               unsigned *line,
                                               unsigned *column,
@@ -588,7 +588,7 @@
  * \param offset [out] if non-NULL, will be set to the offset into the
  * buffer to which the given source location points.
  */
-CINDEX_LINKAGE void clang_getFileLocation(CXSourceLocation location,
+CINDEX_LINKAGE void CINDEX_CC clang_getFileLocation(CXSourceLocation location,
                                           CXFile *file,
                                           unsigned *line,
                                           unsigned *column,
@@ -598,13 +598,13 @@
  * \brief Retrieve a source location representing the first character within a
  * source range.
  */
-CINDEX_LINKAGE CXSourceLocation clang_getRangeStart(CXSourceRange range);
+CINDEX_LINKAGE CXSourceLocation CINDEX_CC clang_getRangeStart(CXSourceRange range);
 
 /**
  * \brief Retrieve a source location representing the last character within a
  * source range.
  */
-CINDEX_LINKAGE CXSourceLocation clang_getRangeEnd(CXSourceRange range);
+CINDEX_LINKAGE CXSourceLocation CINDEX_CC clang_getRangeEnd(CXSourceRange range);
 
 /**
  * \brief Identifies an array of ranges.
@@ -624,13 +624,13 @@
  * The preprocessor will skip lines when they are surrounded by an
  * if/ifdef/ifndef directive whose condition does not evaluate to true.
  */
-CINDEX_LINKAGE CXSourceRangeList *clang_getSkippedRanges(CXTranslationUnit tu,
+CINDEX_LINKAGE CXSourceRangeList * CINDEX_CC clang_getSkippedRanges(CXTranslationUnit tu,
                                                          CXFile file);
 
 /**
  * \brief Destroy the given \c CXSourceRangeList.
  */
-CINDEX_LINKAGE void clang_disposeSourceRangeList(CXSourceRangeList *ranges);
+CINDEX_LINKAGE void CINDEX_CC clang_disposeSourceRangeList(CXSourceRangeList *ranges);
 
 /**
  * @}
@@ -691,7 +691,7 @@
 /**
  * \brief Determine the number of diagnostics in a CXDiagnosticSet.
  */
-CINDEX_LINKAGE unsigned clang_getNumDiagnosticsInSet(CXDiagnosticSet Diags);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_getNumDiagnosticsInSet(CXDiagnosticSet Diags);
 
 /**
  * \brief Retrieve a diagnostic associated with the given CXDiagnosticSet.
@@ -702,7 +702,7 @@
  * \returns the requested diagnostic. This diagnostic must be freed
  * via a call to \c clang_disposeDiagnostic().
  */
-CINDEX_LINKAGE CXDiagnostic clang_getDiagnosticInSet(CXDiagnosticSet Diags,
+CINDEX_LINKAGE CXDiagnostic CINDEX_CC clang_getDiagnosticInSet(CXDiagnosticSet Diags,
                                                      unsigned Index);  
 
 
@@ -748,14 +748,14 @@
  * \returns A loaded CXDiagnosticSet if successful, and NULL otherwise.  These
  * diagnostics should be released using clang_disposeDiagnosticSet().
  */
-CINDEX_LINKAGE CXDiagnosticSet clang_loadDiagnostics(const char *file,
+CINDEX_LINKAGE CXDiagnosticSet CINDEX_CC clang_loadDiagnostics(const char *file,
                                                   enum CXLoadDiag_Error *error,
                                                   CXString *errorString);
 
 /**
  * \brief Release a CXDiagnosticSet and all of its contained diagnostics.
  */
-CINDEX_LINKAGE void clang_disposeDiagnosticSet(CXDiagnosticSet Diags);
+CINDEX_LINKAGE void CINDEX_CC clang_disposeDiagnosticSet(CXDiagnosticSet Diags);
 
 /**
  * \brief Retrieve the child diagnostics of a CXDiagnostic. 
@@ -763,13 +763,13 @@
  * This CXDiagnosticSet does not need to be released by
  * clang_disposeDiagnosticSet.
  */
-CINDEX_LINKAGE CXDiagnosticSet clang_getChildDiagnostics(CXDiagnostic D);
+CINDEX_LINKAGE CXDiagnosticSet CINDEX_CC clang_getChildDiagnostics(CXDiagnostic D);
 
 /**
  * \brief Determine the number of diagnostics produced for the given
  * translation unit.
  */
-CINDEX_LINKAGE unsigned clang_getNumDiagnostics(CXTranslationUnit Unit);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_getNumDiagnostics(CXTranslationUnit Unit);
 
 /**
  * \brief Retrieve a diagnostic associated with the given translation unit.
@@ -780,7 +780,7 @@
  * \returns the requested diagnostic. This diagnostic must be freed
  * via a call to \c clang_disposeDiagnostic().
  */
-CINDEX_LINKAGE CXDiagnostic clang_getDiagnostic(CXTranslationUnit Unit,
+CINDEX_LINKAGE CXDiagnostic CINDEX_CC clang_getDiagnostic(CXTranslationUnit Unit,
                                                 unsigned Index);
 
 /**
@@ -790,12 +790,12 @@
  * \param Unit the translation unit to query.
  */
 CINDEX_LINKAGE CXDiagnosticSet
-  clang_getDiagnosticSetFromTU(CXTranslationUnit Unit);  
+CINDEX_CC clang_getDiagnosticSetFromTU(CXTranslationUnit Unit);  
 
 /**
  * \brief Destroy a diagnostic.
  */
-CINDEX_LINKAGE void clang_disposeDiagnostic(CXDiagnostic Diagnostic);
+CINDEX_LINKAGE void CINDEX_CC clang_disposeDiagnostic(CXDiagnostic Diagnostic);
 
 /**
  * \brief Options to control the display of diagnostics.
@@ -880,7 +880,7 @@
  *
  * \returns A new string containing for formatted diagnostic.
  */
-CINDEX_LINKAGE CXString clang_formatDiagnostic(CXDiagnostic Diagnostic,
+CINDEX_LINKAGE CXString CINDEX_CC clang_formatDiagnostic(CXDiagnostic Diagnostic,
                                                unsigned Options);
 
 /**
@@ -890,13 +890,13 @@
  * \returns A set of display options suitable for use with \c
  * clang_formatDiagnostic().
  */
-CINDEX_LINKAGE unsigned clang_defaultDiagnosticDisplayOptions(void);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_defaultDiagnosticDisplayOptions(void);
 
 /**
  * \brief Determine the severity of the given diagnostic.
  */
 CINDEX_LINKAGE enum CXDiagnosticSeverity
-clang_getDiagnosticSeverity(CXDiagnostic);
+CINDEX_CC clang_getDiagnosticSeverity(CXDiagnostic);
 
 /**
  * \brief Retrieve the source location of the given diagnostic.
@@ -904,12 +904,12 @@
  * This location is where Clang would print the caret ('^') when
  * displaying the diagnostic on the command line.
  */
-CINDEX_LINKAGE CXSourceLocation clang_getDiagnosticLocation(CXDiagnostic);
+CINDEX_LINKAGE CXSourceLocation CINDEX_CC clang_getDiagnosticLocation(CXDiagnostic);
 
 /**
  * \brief Retrieve the text of the given diagnostic.
  */
-CINDEX_LINKAGE CXString clang_getDiagnosticSpelling(CXDiagnostic);
+CINDEX_LINKAGE CXString CINDEX_CC clang_getDiagnosticSpelling(CXDiagnostic);
 
 /**
  * \brief Retrieve the name of the command-line option that enabled this
@@ -923,7 +923,7 @@
  * \returns A string that contains the command-line option used to enable this
  * warning, such as "-Wconversion" or "-pedantic". 
  */
-CINDEX_LINKAGE CXString clang_getDiagnosticOption(CXDiagnostic Diag,
+CINDEX_LINKAGE CXString CINDEX_CC clang_getDiagnosticOption(CXDiagnostic Diag,
                                                   CXString *Disable);
 
 /**
@@ -936,7 +936,7 @@
  * \returns The number of the category that contains this diagnostic, or zero
  * if this diagnostic is uncategorized.
  */
-CINDEX_LINKAGE unsigned clang_getDiagnosticCategory(CXDiagnostic);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_getDiagnosticCategory(CXDiagnostic);
 
 /**
  * \brief Retrieve the name of a particular diagnostic category.  This
@@ -949,20 +949,20 @@
  * \returns The name of the given diagnostic category.
  */
 CINDEX_DEPRECATED CINDEX_LINKAGE
-CXString clang_getDiagnosticCategoryName(unsigned Category);
+CXString CINDEX_CC clang_getDiagnosticCategoryName(unsigned Category);
 
 /**
  * \brief Retrieve the diagnostic category text for a given diagnostic.
  *
  * \returns The text of the given diagnostic category.
  */
-CINDEX_LINKAGE CXString clang_getDiagnosticCategoryText(CXDiagnostic);
+CINDEX_LINKAGE CXString CINDEX_CC clang_getDiagnosticCategoryText(CXDiagnostic);
   
 /**
  * \brief Determine the number of source ranges associated with the given
  * diagnostic.
  */
-CINDEX_LINKAGE unsigned clang_getDiagnosticNumRanges(CXDiagnostic);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_getDiagnosticNumRanges(CXDiagnostic);
 
 /**
  * \brief Retrieve a source range associated with the diagnostic.
@@ -977,14 +977,14 @@
  *
  * \returns the requested source range.
  */
-CINDEX_LINKAGE CXSourceRange clang_getDiagnosticRange(CXDiagnostic Diagnostic,
+CINDEX_LINKAGE CXSourceRange CINDEX_CC clang_getDiagnosticRange(CXDiagnostic Diagnostic,
                                                       unsigned Range);
 
 /**
  * \brief Determine the number of fix-it hints associated with the
  * given diagnostic.
  */
-CINDEX_LINKAGE unsigned clang_getDiagnosticNumFixIts(CXDiagnostic Diagnostic);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_getDiagnosticNumFixIts(CXDiagnostic Diagnostic);
 
 /**
  * \brief Retrieve the replacement information for a given fix-it.
@@ -1011,7 +1011,7 @@
  * \returns A string containing text that should be replace the source
  * code indicated by the \c ReplacementRange.
  */
-CINDEX_LINKAGE CXString clang_getDiagnosticFixIt(CXDiagnostic Diagnostic,
+CINDEX_LINKAGE CXString CINDEX_CC clang_getDiagnosticFixIt(CXDiagnostic Diagnostic,
                                                  unsigned FixIt,
                                                CXSourceRange *ReplacementRange);
 
@@ -1033,7 +1033,7 @@
  * \brief Get the original translation unit source file name.
  */
 CINDEX_LINKAGE CXString
-clang_getTranslationUnitSpelling(CXTranslationUnit CTUnit);
+CINDEX_CC clang_getTranslationUnitSpelling(CXTranslationUnit CTUnit);
 
 /**
  * \brief Return the CXTranslationUnit for a given source file and the provided
@@ -1075,7 +1075,7 @@
  * CXUnsavedFile) are copied when necessary, so the client only needs to
  * guarantee their validity until the call to this function returns.
  */
-CINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnitFromSourceFile(
+CINDEX_LINKAGE CXTranslationUnit CINDEX_CC clang_createTranslationUnitFromSourceFile(
                                          CXIndex CIdx,
                                          const char *source_filename,
                                          int num_clang_command_line_args,
@@ -1089,7 +1089,7 @@
  * routine returns a \c NULL \c CXTranslationUnit, without further detailed
  * error codes.
  */
-CINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnit(
+CINDEX_LINKAGE CXTranslationUnit CINDEX_CC clang_createTranslationUnit(
     CXIndex CIdx,
     const char *ast_filename);
 
@@ -1101,7 +1101,7 @@
  *
  * \returns Zero on success, otherwise returns an error code.
  */
-CINDEX_LINKAGE enum CXErrorCode clang_createTranslationUnit2(
+CINDEX_LINKAGE enum CXErrorCode CINDEX_CC clang_createTranslationUnit2(
     CXIndex CIdx,
     const char *ast_filename,
     CXTranslationUnit *out_TU);
@@ -1217,7 +1217,7 @@
  * preamble) geared toward improving the performance of these routines. The
  * set of optimizations enabled may change from one version to the next.
  */
-CINDEX_LINKAGE unsigned clang_defaultEditingTranslationUnitOptions(void);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_defaultEditingTranslationUnitOptions(void);
 
 /**
  * \brief Same as \c clang_parseTranslationUnit2, but returns
@@ -1226,7 +1226,7 @@
  * error codes.
  */
 CINDEX_LINKAGE CXTranslationUnit
-clang_parseTranslationUnit(CXIndex CIdx,
+CINDEX_CC clang_parseTranslationUnit(CXIndex CIdx,
                            const char *source_filename,
                            const char *const *command_line_args,
                            int num_command_line_args,
@@ -1279,7 +1279,7 @@
  * \returns Zero on success, otherwise returns an error code.
  */
 CINDEX_LINKAGE enum CXErrorCode
-clang_parseTranslationUnit2(CXIndex CIdx,
+CINDEX_CC clang_parseTranslationUnit2(CXIndex CIdx,
                             const char *source_filename,
                             const char *const *command_line_args,
                             int num_command_line_args,
@@ -1311,7 +1311,7 @@
  * set contains an unspecified set of options that save translation units with
  * the most commonly-requested data.
  */
-CINDEX_LINKAGE unsigned clang_defaultSaveOptions(CXTranslationUnit TU);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_defaultSaveOptions(CXTranslationUnit TU);
 
 /**
  * \brief Describes the kind of error that occurred (if any) in a call to
@@ -1371,14 +1371,14 @@
  * enumeration. Zero (CXSaveError_None) indicates that the translation unit was 
  * saved successfully, while a non-zero value indicates that a problem occurred.
  */
-CINDEX_LINKAGE int clang_saveTranslationUnit(CXTranslationUnit TU,
+CINDEX_LINKAGE int CINDEX_CC clang_saveTranslationUnit(CXTranslationUnit TU,
                                              const char *FileName,
                                              unsigned options);
 
 /**
  * \brief Destroy the specified CXTranslationUnit object.
  */
-CINDEX_LINKAGE void clang_disposeTranslationUnit(CXTranslationUnit);
+CINDEX_LINKAGE void CINDEX_CC clang_disposeTranslationUnit(CXTranslationUnit);
 
 /**
  * \brief Flags that control the reparsing of translation units.
@@ -1404,7 +1404,7 @@
  * of reparsing. The set of optimizations enabled may change from one version 
  * to the next.
  */
-CINDEX_LINKAGE unsigned clang_defaultReparseOptions(CXTranslationUnit TU);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_defaultReparseOptions(CXTranslationUnit TU);
 
 /**
  * \brief Reparse the source files that produced this translation unit.
@@ -1445,7 +1445,7 @@
  * \c clang_disposeTranslationUnit(TU).  The error codes returned by this
  * routine are described by the \c CXErrorCode enum.
  */
-CINDEX_LINKAGE int clang_reparseTranslationUnit(CXTranslationUnit TU,
+CINDEX_LINKAGE int CINDEX_CC clang_reparseTranslationUnit(CXTranslationUnit TU,
                                                 unsigned num_unsaved_files,
                                           struct CXUnsavedFile *unsaved_files,
                                                 unsigned options);
@@ -1481,7 +1481,7 @@
   *  the name of the memory category.  This string should never be freed.
   */
 CINDEX_LINKAGE
-const char *clang_getTUResourceUsageName(enum CXTUResourceUsageKind kind);
+const char * CINDEX_CC clang_getTUResourceUsageName(enum CXTUResourceUsageKind kind);
 
 typedef struct CXTUResourceUsageEntry {
   /* \brief The memory usage category. */
@@ -1511,9 +1511,9 @@
   * \brief Return the memory usage of a translation unit.  This object
   *  should be released with clang_disposeCXTUResourceUsage().
   */
-CINDEX_LINKAGE CXTUResourceUsage clang_getCXTUResourceUsage(CXTranslationUnit TU);
+CINDEX_LINKAGE CXTUResourceUsage CINDEX_CC clang_getCXTUResourceUsage(CXTranslationUnit TU);
 
-CINDEX_LINKAGE void clang_disposeCXTUResourceUsage(CXTUResourceUsage usage);
+CINDEX_LINKAGE void CINDEX_CC clang_disposeCXTUResourceUsage(CXTUResourceUsage usage);
 
 /**
  * @}
@@ -2312,7 +2312,7 @@
 /**
  * \brief Retrieve the NULL cursor, which represents no entity.
  */
-CINDEX_LINKAGE CXCursor clang_getNullCursor(void);
+CINDEX_LINKAGE CXCursor CINDEX_CC clang_getNullCursor(void);
 
 /**
  * \brief Retrieve the cursor that represents the given translation unit.
@@ -2320,32 +2320,32 @@
  * The translation unit cursor can be used to start traversing the
  * various declarations within the given translation unit.
  */
-CINDEX_LINKAGE CXCursor clang_getTranslationUnitCursor(CXTranslationUnit);
+CINDEX_LINKAGE CXCursor CINDEX_CC clang_getTranslationUnitCursor(CXTranslationUnit);
 
 /**
  * \brief Determine whether two cursors are equivalent.
  */
-CINDEX_LINKAGE unsigned clang_equalCursors(CXCursor, CXCursor);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_equalCursors(CXCursor, CXCursor);
 
 /**
  * \brief Returns non-zero if \p cursor is null.
  */
-CINDEX_LINKAGE int clang_Cursor_isNull(CXCursor cursor);
+CINDEX_LINKAGE int CINDEX_CC clang_Cursor_isNull(CXCursor cursor);
 
 /**
  * \brief Compute a hash value for the given cursor.
  */
-CINDEX_LINKAGE unsigned clang_hashCursor(CXCursor);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_hashCursor(CXCursor);
   
 /**
  * \brief Retrieve the kind of the given cursor.
  */
-CINDEX_LINKAGE enum CXCursorKind clang_getCursorKind(CXCursor);
+CINDEX_LINKAGE enum CXCursorKind CINDEX_CC clang_getCursorKind(CXCursor);
 
 /**
  * \brief Determine whether the given cursor kind represents a declaration.
  */
-CINDEX_LINKAGE unsigned clang_isDeclaration(enum CXCursorKind);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_isDeclaration(enum CXCursorKind);
 
 /**
  * \brief Determine whether the given cursor kind represents a simple
@@ -2355,46 +2355,46 @@
  * other cursors. Use clang_getCursorReferenced() to determine whether a
  * particular cursor refers to another entity.
  */
-CINDEX_LINKAGE unsigned clang_isReference(enum CXCursorKind);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_isReference(enum CXCursorKind);
 
 /**
  * \brief Determine whether the given cursor kind represents an expression.
  */
-CINDEX_LINKAGE unsigned clang_isExpression(enum CXCursorKind);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_isExpression(enum CXCursorKind);
 
 /**
  * \brief Determine whether the given cursor kind represents a statement.
  */
-CINDEX_LINKAGE unsigned clang_isStatement(enum CXCursorKind);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_isStatement(enum CXCursorKind);
 
 /**
  * \brief Determine whether the given cursor kind represents an attribute.
  */
-CINDEX_LINKAGE unsigned clang_isAttribute(enum CXCursorKind);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_isAttribute(enum CXCursorKind);
 
 /**
  * \brief Determine whether the given cursor kind represents an invalid
  * cursor.
  */
-CINDEX_LINKAGE unsigned clang_isInvalid(enum CXCursorKind);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_isInvalid(enum CXCursorKind);
 
 /**
  * \brief Determine whether the given cursor kind represents a translation
  * unit.
  */
-CINDEX_LINKAGE unsigned clang_isTranslationUnit(enum CXCursorKind);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_isTranslationUnit(enum CXCursorKind);
 
 /***
  * \brief Determine whether the given cursor represents a preprocessing
  * element, such as a preprocessor directive or macro instantiation.
  */
-CINDEX_LINKAGE unsigned clang_isPreprocessing(enum CXCursorKind);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_isPreprocessing(enum CXCursorKind);
   
 /***
  * \brief Determine whether the given cursor represents a currently
  *  unexposed piece of the AST (e.g., CXCursor_UnexposedStmt).
  */
-CINDEX_LINKAGE unsigned clang_isUnexposed(enum CXCursorKind);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_isUnexposed(enum CXCursorKind);
 
 /**
  * \brief Describe the linkage of the entity referred to by a cursor.
@@ -2420,7 +2420,7 @@
 /**
  * \brief Determine the linkage of the entity referred to by a given cursor.
  */
-CINDEX_LINKAGE enum CXLinkageKind clang_getCursorLinkage(CXCursor cursor);
+CINDEX_LINKAGE enum CXLinkageKind CINDEX_CC clang_getCursorLinkage(CXCursor cursor);
 
 /**
  * \brief Determine the availability of the entity that this cursor refers to,
@@ -2431,7 +2431,7 @@
  * \returns The availability of the cursor.
  */
 CINDEX_LINKAGE enum CXAvailabilityKind 
-clang_getCursorAvailability(CXCursor cursor);
+CINDEX_CC clang_getCursorAvailability(CXCursor cursor);
 
 /**
  * Describes the availability of a given entity on a particular platform, e.g.,
@@ -2507,7 +2507,7 @@
  * \c min(N, availability_size) such structures.
  */
 CINDEX_LINKAGE int
-clang_getCursorPlatformAvailability(CXCursor cursor,
+CINDEX_CC clang_getCursorPlatformAvailability(CXCursor cursor,
                                     int *always_deprecated,
                                     CXString *deprecated_message,
                                     int *always_unavailable,
@@ -2519,7 +2519,7 @@
  * \brief Free the memory associated with a \c CXPlatformAvailability structure.
  */
 CINDEX_LINKAGE void
-clang_disposeCXPlatformAvailability(CXPlatformAvailability *availability);
+CINDEX_CC clang_disposeCXPlatformAvailability(CXPlatformAvailability *availability);
   
 /**
  * \brief Describe the "language" of the entity referred to by a cursor.
@@ -2534,12 +2534,12 @@
 /**
  * \brief Determine the "language" of the entity referred to by a given cursor.
  */
-CINDEX_LINKAGE enum CXLanguageKind clang_getCursorLanguage(CXCursor cursor);
+CINDEX_LINKAGE enum CXLanguageKind CINDEX_CC clang_getCursorLanguage(CXCursor cursor);
 
 /**
  * \brief Returns the translation unit that a cursor originated from.
  */
-CINDEX_LINKAGE CXTranslationUnit clang_Cursor_getTranslationUnit(CXCursor);
+CINDEX_LINKAGE CXTranslationUnit CINDEX_CC clang_Cursor_getTranslationUnit(CXCursor);
 
 
 /**
@@ -2550,19 +2550,19 @@
 /**
  * \brief Creates an empty CXCursorSet.
  */
-CINDEX_LINKAGE CXCursorSet clang_createCXCursorSet(void);
+CINDEX_LINKAGE CXCursorSet CINDEX_CC clang_createCXCursorSet(void);
 
 /**
  * \brief Disposes a CXCursorSet and releases its associated memory.
  */
-CINDEX_LINKAGE void clang_disposeCXCursorSet(CXCursorSet cset);
+CINDEX_LINKAGE void CINDEX_CC clang_disposeCXCursorSet(CXCursorSet cset);
 
 /**
  * \brief Queries a CXCursorSet to see if it contains a specific CXCursor.
  *
  * \returns non-zero if the set contains the specified cursor.
 */
-CINDEX_LINKAGE unsigned clang_CXCursorSet_contains(CXCursorSet cset,
+CINDEX_LINKAGE unsigned CINDEX_CC clang_CXCursorSet_contains(CXCursorSet cset,
                                                    CXCursor cursor);
 
 /**
@@ -2570,7 +2570,7 @@
  *
  * \returns zero if the CXCursor was already in the set, and non-zero otherwise.
 */
-CINDEX_LINKAGE unsigned clang_CXCursorSet_insert(CXCursorSet cset,
+CINDEX_LINKAGE unsigned CINDEX_CC clang_CXCursorSet_insert(CXCursorSet cset,
                                                  CXCursor cursor);
 
 /**
@@ -2606,7 +2606,7 @@
  *
  * For global declarations, the semantic parent is the translation unit.
  */
-CINDEX_LINKAGE CXCursor clang_getCursorSemanticParent(CXCursor cursor);
+CINDEX_LINKAGE CXCursor CINDEX_CC clang_getCursorSemanticParent(CXCursor cursor);
 
 /**
  * \brief Determine the lexical parent of the given cursor.
@@ -2642,7 +2642,7 @@
  * For declarations written in the global scope, the lexical parent is
  * the translation unit.
  */
-CINDEX_LINKAGE CXCursor clang_getCursorLexicalParent(CXCursor cursor);
+CINDEX_LINKAGE CXCursor CINDEX_CC clang_getCursorLexicalParent(CXCursor cursor);
 
 /**
  * \brief Determine the set of methods that are overridden by the given
@@ -2687,7 +2687,7 @@
  * functions, will be set to the number of overridden functions in the
  * array pointed to by \p overridden.
  */
-CINDEX_LINKAGE void clang_getOverriddenCursors(CXCursor cursor, 
+CINDEX_LINKAGE void CINDEX_CC clang_getOverriddenCursors(CXCursor cursor, 
                                                CXCursor **overridden,
                                                unsigned *num_overridden);
 
@@ -2695,13 +2695,13 @@
  * \brief Free the set of overridden cursors returned by \c
  * clang_getOverriddenCursors().
  */
-CINDEX_LINKAGE void clang_disposeOverriddenCursors(CXCursor *overridden);
+CINDEX_LINKAGE void CINDEX_CC clang_disposeOverriddenCursors(CXCursor *overridden);
 
 /**
  * \brief Retrieve the file that is included by the given inclusion directive
  * cursor.
  */
-CINDEX_LINKAGE CXFile clang_getIncludedFile(CXCursor cursor);
+CINDEX_LINKAGE CXFile CINDEX_CC clang_getIncludedFile(CXCursor cursor);
   
 /**
  * @}
@@ -2733,7 +2733,7 @@
  * \returns a cursor representing the entity at the given source location, or
  * a NULL cursor if no such entity can be found.
  */
-CINDEX_LINKAGE CXCursor clang_getCursor(CXTranslationUnit, CXSourceLocation);
+CINDEX_LINKAGE CXCursor CINDEX_CC clang_getCursor(CXTranslationUnit, CXSourceLocation);
 
 /**
  * \brief Retrieve the physical location of the source constructor referenced
@@ -2745,7 +2745,7 @@
  * The location of a reference is where that reference occurs within the
  * source code.
  */
-CINDEX_LINKAGE CXSourceLocation clang_getCursorLocation(CXCursor);
+CINDEX_LINKAGE CXSourceLocation CINDEX_CC clang_getCursorLocation(CXCursor);
 
 /**
  * \brief Retrieve the physical extent of the source construct referenced by
@@ -2758,7 +2758,7 @@
  * the extent covers the location of the reference (e.g., where the referenced
  * entity was actually used).
  */
-CINDEX_LINKAGE CXSourceRange clang_getCursorExtent(CXCursor);
+CINDEX_LINKAGE CXSourceRange CINDEX_CC clang_getCursorExtent(CXCursor);
 
 /**
  * @}
@@ -2871,7 +2871,7 @@
 /**
  * \brief Retrieve the type of a CXCursor (if any).
  */
-CINDEX_LINKAGE CXType clang_getCursorType(CXCursor C);
+CINDEX_LINKAGE CXType CINDEX_CC clang_getCursorType(CXCursor C);
 
 /**
  * \brief Pretty-print the underlying type using the rules of the
@@ -2879,7 +2879,7 @@
  *
  * If the type is invalid, an empty string is returned.
  */
-CINDEX_LINKAGE CXString clang_getTypeSpelling(CXType CT);
+CINDEX_LINKAGE CXString CINDEX_CC clang_getTypeSpelling(CXType CT);
 
 /**
  * \brief Retrieve the underlying type of a typedef declaration.
@@ -2887,7 +2887,7 @@
  * If the cursor does not reference a typedef declaration, an invalid type is
  * returned.
  */
-CINDEX_LINKAGE CXType clang_getTypedefDeclUnderlyingType(CXCursor C);
+CINDEX_LINKAGE CXType CINDEX_CC clang_getTypedefDeclUnderlyingType(CXCursor C);
 
 /**
  * \brief Retrieve the integer type of an enum declaration.
@@ -2895,7 +2895,7 @@
  * If the cursor does not reference an enum declaration, an invalid type is
  * returned.
  */
-CINDEX_LINKAGE CXType clang_getEnumDeclIntegerType(CXCursor C);
+CINDEX_LINKAGE CXType CINDEX_CC clang_getEnumDeclIntegerType(CXCursor C);
 
 /**
  * \brief Retrieve the integer value of an enum constant declaration as a signed
@@ -2905,7 +2905,7 @@
  * Since this is also potentially a valid constant value, the kind of the cursor
  * must be verified before calling this function.
  */
-CINDEX_LINKAGE long long clang_getEnumConstantDeclValue(CXCursor C);
+CINDEX_LINKAGE long long CINDEX_CC clang_getEnumConstantDeclValue(CXCursor C);
 
 /**
  * \brief Retrieve the integer value of an enum constant declaration as an unsigned
@@ -2915,14 +2915,14 @@
  * Since this is also potentially a valid constant value, the kind of the cursor
  * must be verified before calling this function.
  */
-CINDEX_LINKAGE unsigned long long clang_getEnumConstantDeclUnsignedValue(CXCursor C);
+CINDEX_LINKAGE unsigned long long CINDEX_CC clang_getEnumConstantDeclUnsignedValue(CXCursor C);
 
 /**
  * \brief Retrieve the bit width of a bit field declaration as an integer.
  *
  * If a cursor that is not a bit field declaration is passed in, -1 is returned.
  */
-CINDEX_LINKAGE int clang_getFieldDeclBitWidth(CXCursor C);
+CINDEX_LINKAGE int CINDEX_CC clang_getFieldDeclBitWidth(CXCursor C);
 
 /**
  * \brief Retrieve the number of non-variadic arguments associated with a given
@@ -2931,7 +2931,7 @@
  * The number of arguments can be determined for calls as well as for
  * declarations of functions or methods. For other cursors -1 is returned.
  */
-CINDEX_LINKAGE int clang_Cursor_getNumArguments(CXCursor C);
+CINDEX_LINKAGE int CINDEX_CC clang_Cursor_getNumArguments(CXCursor C);
 
 /**
  * \brief Retrieve the argument cursor of a function or method.
@@ -2940,7 +2940,7 @@
  * of functions or methods. For other cursors and for invalid indices, an
  * invalid cursor is returned.
  */
-CINDEX_LINKAGE CXCursor clang_Cursor_getArgument(CXCursor C, unsigned i);
+CINDEX_LINKAGE CXCursor CINDEX_CC clang_Cursor_getArgument(CXCursor C, unsigned i);
 
 /**
  * \brief Describes the kind of a template argument.
@@ -2978,7 +2978,7 @@
  *
  * The value 3 would be returned from this call.
  */
-CINDEX_LINKAGE int clang_Cursor_getNumTemplateArguments(CXCursor C);
+CINDEX_LINKAGE int CINDEX_CC clang_Cursor_getNumTemplateArguments(CXCursor C);
 
 /**
  * \brief Retrieve the kind of the I'th template argument of the CXCursor C.
@@ -2996,7 +2996,7 @@
  * For I = 0, 1, and 2, Type, Integral, and Integral will be returned,
  * respectively.
  */
-CINDEX_LINKAGE enum CXTemplateArgumentKind clang_Cursor_getTemplateArgumentKind(
+CINDEX_LINKAGE enum CXTemplateArgumentKind CINDEX_CC clang_Cursor_getTemplateArgumentKind(
     CXCursor C, unsigned I);
 
 /**
@@ -3017,7 +3017,7 @@
  * If called with I = 0, "float", will be returned.
  * Invalid types will be returned for I == 1 or 2.
  */
-CINDEX_LINKAGE CXType clang_Cursor_getTemplateArgumentType(CXCursor C,
+CINDEX_LINKAGE CXType CINDEX_CC clang_Cursor_getTemplateArgumentType(CXCursor C,
                                                            unsigned I);
 
 /**
@@ -3037,7 +3037,7 @@
  * If called with I = 1 or 2, -7 or true will be returned, respectively.
  * For I == 0, this function's behavior is undefined.
  */
-CINDEX_LINKAGE long long clang_Cursor_getTemplateArgumentValue(CXCursor C,
+CINDEX_LINKAGE long long CINDEX_CC clang_Cursor_getTemplateArgumentValue(CXCursor C,
                                                                unsigned I);
 
 /**
@@ -3057,7 +3057,7 @@
  * If called with I = 1 or 2, 2147483649 or true will be returned, respectively.
  * For I == 0, this function's behavior is undefined.
  */
-CINDEX_LINKAGE unsigned long long clang_Cursor_getTemplateArgumentUnsignedValue(
+CINDEX_LINKAGE unsigned long long CINDEX_CC clang_Cursor_getTemplateArgumentUnsignedValue(
     CXCursor C, unsigned I);
 
 /**
@@ -3066,7 +3066,7 @@
  * \returns non-zero if the CXTypes represent the same type and
  *          zero otherwise.
  */
-CINDEX_LINKAGE unsigned clang_equalTypes(CXType A, CXType B);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_equalTypes(CXType A, CXType B);
 
 /**
  * \brief Return the canonical type for a CXType.
@@ -3076,62 +3076,62 @@
  * type with all the "sugar" removed.  For example, if 'T' is a typedef
  * for 'int', the canonical type for 'T' would be 'int'.
  */
-CINDEX_LINKAGE CXType clang_getCanonicalType(CXType T);
+CINDEX_LINKAGE CXType CINDEX_CC clang_getCanonicalType(CXType T);
 
 /**
  * \brief Determine whether a CXType has the "const" qualifier set,
  * without looking through typedefs that may have added "const" at a
  * different level.
  */
-CINDEX_LINKAGE unsigned clang_isConstQualifiedType(CXType T);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_isConstQualifiedType(CXType T);
 
 /**
  * \brief Determine whether a CXType has the "volatile" qualifier set,
  * without looking through typedefs that may have added "volatile" at
  * a different level.
  */
-CINDEX_LINKAGE unsigned clang_isVolatileQualifiedType(CXType T);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_isVolatileQualifiedType(CXType T);
 
 /**
  * \brief Determine whether a CXType has the "restrict" qualifier set,
  * without looking through typedefs that may have added "restrict" at a
  * different level.
  */
-CINDEX_LINKAGE unsigned clang_isRestrictQualifiedType(CXType T);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_isRestrictQualifiedType(CXType T);
 
 /**
  * \brief For pointer types, returns the type of the pointee.
  */
-CINDEX_LINKAGE CXType clang_getPointeeType(CXType T);
+CINDEX_LINKAGE CXType CINDEX_CC clang_getPointeeType(CXType T);
 
 /**
  * \brief Return the cursor for the declaration of the given type.
  */
-CINDEX_LINKAGE CXCursor clang_getTypeDeclaration(CXType T);
+CINDEX_LINKAGE CXCursor CINDEX_CC clang_getTypeDeclaration(CXType T);
 
 /**
  * Returns the Objective-C type encoding for the specified declaration.
  */
-CINDEX_LINKAGE CXString clang_getDeclObjCTypeEncoding(CXCursor C);
+CINDEX_LINKAGE CXString CINDEX_CC clang_getDeclObjCTypeEncoding(CXCursor C);
 
 /**
  * \brief Retrieve the spelling of a given CXTypeKind.
  */
-CINDEX_LINKAGE CXString clang_getTypeKindSpelling(enum CXTypeKind K);
+CINDEX_LINKAGE CXString CINDEX_CC clang_getTypeKindSpelling(enum CXTypeKind K);
 
 /**
  * \brief Retrieve the calling convention associated with a function type.
  *
  * If a non-function type is passed in, CXCallingConv_Invalid is returned.
  */
-CINDEX_LINKAGE enum CXCallingConv clang_getFunctionTypeCallingConv(CXType T);
+CINDEX_LINKAGE enum CXCallingConv CINDEX_CC clang_getFunctionTypeCallingConv(CXType T);
 
 /**
  * \brief Retrieve the return type associated with a function type.
  *
  * If a non-function type is passed in, an invalid type is returned.
  */
-CINDEX_LINKAGE CXType clang_getResultType(CXType T);
+CINDEX_LINKAGE CXType CINDEX_CC clang_getResultType(CXType T);
 
 /**
  * \brief Retrieve the number of non-variadic parameters associated with a
@@ -3139,7 +3139,7 @@
  *
  * If a non-function type is passed in, -1 is returned.
  */
-CINDEX_LINKAGE int clang_getNumArgTypes(CXType T);
+CINDEX_LINKAGE int CINDEX_CC clang_getNumArgTypes(CXType T);
 
 /**
  * \brief Retrieve the type of a parameter of a function type.
@@ -3147,25 +3147,25 @@
  * If a non-function type is passed in or the function does not have enough
  * parameters, an invalid type is returned.
  */
-CINDEX_LINKAGE CXType clang_getArgType(CXType T, unsigned i);
+CINDEX_LINKAGE CXType CINDEX_CC clang_getArgType(CXType T, unsigned i);
 
 /**
  * \brief Return 1 if the CXType is a variadic function type, and 0 otherwise.
  */
-CINDEX_LINKAGE unsigned clang_isFunctionTypeVariadic(CXType T);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_isFunctionTypeVariadic(CXType T);
 
 /**
  * \brief Retrieve the return type associated with a given cursor.
  *
  * This only returns a valid type if the cursor refers to a function or method.
  */
-CINDEX_LINKAGE CXType clang_getCursorResultType(CXCursor C);
+CINDEX_LINKAGE CXType CINDEX_CC clang_getCursorResultType(CXCursor C);
 
 /**
  * \brief Return 1 if the CXType is a POD (plain old data) type, and 0
  *  otherwise.
  */
-CINDEX_LINKAGE unsigned clang_isPODType(CXType T);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_isPODType(CXType T);
 
 /**
  * \brief Return the element type of an array, complex, or vector type.
@@ -3173,7 +3173,7 @@
  * If a type is passed in that is not an array, complex, or vector type,
  * an invalid type is returned.
  */
-CINDEX_LINKAGE CXType clang_getElementType(CXType T);
+CINDEX_LINKAGE CXType CINDEX_CC clang_getElementType(CXType T);
 
 /**
  * \brief Return the number of elements of an array or vector type.
@@ -3181,21 +3181,21 @@
  * If a type is passed in that is not an array or vector type,
  * -1 is returned.
  */
-CINDEX_LINKAGE long long clang_getNumElements(CXType T);
+CINDEX_LINKAGE long long CINDEX_CC clang_getNumElements(CXType T);
 
 /**
  * \brief Return the element type of an array type.
  *
  * If a non-array type is passed in, an invalid type is returned.
  */
-CINDEX_LINKAGE CXType clang_getArrayElementType(CXType T);
+CINDEX_LINKAGE CXType CINDEX_CC clang_getArrayElementType(CXType T);
 
 /**
  * \brief Return the array size of a constant array.
  *
  * If a non-array type is passed in, -1 is returned.
  */
-CINDEX_LINKAGE long long clang_getArraySize(CXType T);
+CINDEX_LINKAGE long long CINDEX_CC clang_getArraySize(CXType T);
 
 /**
  * \brief List the possible error codes for \c clang_Type_getSizeOf,
@@ -3240,14 +3240,14 @@
  * If the type declaration is not a constant size type,
  *   CXTypeLayoutError_NotConstantSize is returned.
  */
-CINDEX_LINKAGE long long clang_Type_getAlignOf(CXType T);
+CINDEX_LINKAGE long long CINDEX_CC clang_Type_getAlignOf(CXType T);
 
 /**
  * \brief Return the class type of an member pointer type.
  *
  * If a non-member-pointer type is passed in, an invalid type is returned.
  */
-CINDEX_LINKAGE CXType clang_Type_getClassType(CXType T);
+CINDEX_LINKAGE CXType CINDEX_CC clang_Type_getClassType(CXType T);
 
 /**
  * \brief Return the size of a type in bytes as per C++[expr.sizeof] standard.
@@ -3258,7 +3258,7 @@
  * If the type declaration is a dependent type, CXTypeLayoutError_Dependent is
  *   returned.
  */
-CINDEX_LINKAGE long long clang_Type_getSizeOf(CXType T);
+CINDEX_LINKAGE long long CINDEX_CC clang_Type_getSizeOf(CXType T);
 
 /**
  * \brief Return the offset of a field named S in a record of type T in bits
@@ -3273,7 +3273,7 @@
  * If the field's name S is not found,
  *   CXTypeLayoutError_InvalidFieldName is returned.
  */
-CINDEX_LINKAGE long long clang_Type_getOffsetOf(CXType T, const char *S);
+CINDEX_LINKAGE long long CINDEX_CC clang_Type_getOffsetOf(CXType T, const char *S);
 
 enum CXRefQualifierKind {
   /** \brief No ref-qualifier was provided. */
@@ -3291,7 +3291,7 @@
  * Variadic argument packs count as only one argument, and can not be inspected
  * further.
  */
-CINDEX_LINKAGE int clang_Type_getNumTemplateArguments(CXType T);
+CINDEX_LINKAGE int CINDEX_CC clang_Type_getNumTemplateArguments(CXType T);
 
 /**
  * \brief Returns the type template argument of a template class specialization
@@ -3300,7 +3300,7 @@
  * This function only returns template type arguments and does not handle
  * template template arguments or variadic packs.
  */
-CINDEX_LINKAGE CXType clang_Type_getTemplateArgumentAsType(CXType T, unsigned i);
+CINDEX_LINKAGE CXType CINDEX_CC clang_Type_getTemplateArgumentAsType(CXType T, unsigned i);
 
 /**
  * \brief Retrieve the ref-qualifier kind of a function or method.
@@ -3308,19 +3308,19 @@
  * The ref-qualifier is returned for C++ functions or methods. For other types
  * or non-C++ declarations, CXRefQualifier_None is returned.
  */
-CINDEX_LINKAGE enum CXRefQualifierKind clang_Type_getCXXRefQualifier(CXType T);
+CINDEX_LINKAGE enum CXRefQualifierKind CINDEX_CC clang_Type_getCXXRefQualifier(CXType T);
 
 /**
  * \brief Returns non-zero if the cursor specifies a Record member that is a
  *   bitfield.
  */
-CINDEX_LINKAGE unsigned clang_Cursor_isBitField(CXCursor C);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_Cursor_isBitField(CXCursor C);
 
 /**
  * \brief Returns 1 if the base class specified by the cursor with kind
  *   CX_CXXBaseSpecifier is virtual.
  */
-CINDEX_LINKAGE unsigned clang_isVirtualBase(CXCursor);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_isVirtualBase(CXCursor);
     
 /**
  * \brief Represents the C++ access control level to a base class for a
@@ -3340,7 +3340,7 @@
  * parent scope is returned. Otherwise, if the cursor refers to a base specifier or
  * access specifier, the specifier itself is returned.
  */
-CINDEX_LINKAGE enum CX_CXXAccessSpecifier clang_getCXXAccessSpecifier(CXCursor);
+CINDEX_LINKAGE enum CX_CXXAccessSpecifier CINDEX_CC clang_getCXXAccessSpecifier(CXCursor);
 
 /**
  * \brief Represents the storage classes as declared in the source. CX_SC_Invalid
@@ -3363,7 +3363,7 @@
  * If the passed in Cursor is not a function or variable declaration,
  * CX_SC_Invalid is returned else the storage class.
  */
-CINDEX_LINKAGE enum CX_StorageClass clang_Cursor_getStorageClass(CXCursor);
+CINDEX_LINKAGE enum CX_StorageClass CINDEX_CC clang_Cursor_getStorageClass(CXCursor);
 
 /**
  * \brief Determine the number of overloaded declarations referenced by a 
@@ -3374,7 +3374,7 @@
  * \returns The number of overloaded declarations referenced by \c cursor. If it
  * is not a \c CXCursor_OverloadedDeclRef cursor, returns 0.
  */
-CINDEX_LINKAGE unsigned clang_getNumOverloadedDecls(CXCursor cursor);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_getNumOverloadedDecls(CXCursor cursor);
 
 /**
  * \brief Retrieve a cursor for one of the overloaded declarations referenced
@@ -3390,7 +3390,7 @@
  * associated set of overloaded declarations, or if the index is out of bounds,
  * returns \c clang_getNullCursor();
  */
-CINDEX_LINKAGE CXCursor clang_getOverloadedDecl(CXCursor cursor, 
+CINDEX_LINKAGE CXCursor CINDEX_CC clang_getOverloadedDecl(CXCursor cursor, 
                                                 unsigned index);
   
 /**
@@ -3409,7 +3409,7 @@
  *  this function returns the collection element type.
  *
  */
-CINDEX_LINKAGE CXType clang_getIBOutletCollectionType(CXCursor);
+CINDEX_LINKAGE CXType CINDEX_CC clang_getIBOutletCollectionType(CXCursor);
 
 /**
  * @}
@@ -3486,7 +3486,7 @@
  * \returns a non-zero value if the traversal was terminated
  * prematurely by the visitor returning \c CXChildVisit_Break.
  */
-CINDEX_LINKAGE unsigned clang_visitChildren(CXCursor parent,
+CINDEX_LINKAGE unsigned CINDEX_CC clang_visitChildren(CXCursor parent,
                                             CXCursorVisitor visitor,
                                             CXClientData client_data);
 #ifdef __has_feature
@@ -3508,7 +3508,7 @@
  * Visits the children of a cursor using the specified block.  Behaves
  * identically to clang_visitChildren() in all other respects.
  */
-unsigned clang_visitChildrenWithBlock(CXCursor parent,
+unsigned CINDEX_CC clang_visitChildrenWithBlock(CXCursor parent,
                                       CXCursorVisitorBlock block);
 #  endif
 #endif
@@ -3537,39 +3537,39 @@
  * compared across translation units to determine, e.g., when references in
  * one translation refer to an entity defined in another translation unit.
  */
-CINDEX_LINKAGE CXString clang_getCursorUSR(CXCursor);
+CINDEX_LINKAGE CXString CINDEX_CC clang_getCursorUSR(CXCursor);
 
 /**
  * \brief Construct a USR for a specified Objective-C class.
  */
-CINDEX_LINKAGE CXString clang_constructUSR_ObjCClass(const char *class_name);
+CINDEX_LINKAGE CXString CINDEX_CC clang_constructUSR_ObjCClass(const char *class_name);
 
 /**
  * \brief Construct a USR for a specified Objective-C category.
  */
 CINDEX_LINKAGE CXString
-  clang_constructUSR_ObjCCategory(const char *class_name,
+CINDEX_CC clang_constructUSR_ObjCCategory(const char *class_name,
                                  const char *category_name);
 
 /**
  * \brief Construct a USR for a specified Objective-C protocol.
  */
 CINDEX_LINKAGE CXString
-  clang_constructUSR_ObjCProtocol(const char *protocol_name);
+CINDEX_CC clang_constructUSR_ObjCProtocol(const char *protocol_name);
 
 
 /**
  * \brief Construct a USR for a specified Objective-C instance variable and
  *   the USR for its containing class.
  */
-CINDEX_LINKAGE CXString clang_constructUSR_ObjCIvar(const char *name,
+CINDEX_LINKAGE CXString CINDEX_CC clang_constructUSR_ObjCIvar(const char *name,
                                                     CXString classUSR);
 
 /**
  * \brief Construct a USR for a specified Objective-C method and
  *   the USR for its containing class.
  */
-CINDEX_LINKAGE CXString clang_constructUSR_ObjCMethod(const char *name,
+CINDEX_LINKAGE CXString CINDEX_CC clang_constructUSR_ObjCMethod(const char *name,
                                                       unsigned isInstanceMethod,
                                                       CXString classUSR);
 
@@ -3577,13 +3577,13 @@
  * \brief Construct a USR for a specified Objective-C property and the USR
  *  for its containing class.
  */
-CINDEX_LINKAGE CXString clang_constructUSR_ObjCProperty(const char *property,
+CINDEX_LINKAGE CXString CINDEX_CC clang_constructUSR_ObjCProperty(const char *property,
                                                         CXString classUSR);
 
 /**
  * \brief Retrieve a name for the entity referenced by this cursor.
  */
-CINDEX_LINKAGE CXString clang_getCursorSpelling(CXCursor);
+CINDEX_LINKAGE CXString CINDEX_CC clang_getCursorSpelling(CXCursor);
 
 /**
  * \brief Retrieve a range for a piece that forms the cursors spelling name.
@@ -3596,7 +3596,7 @@
  *  
  * \param options Reserved.
  */
-CINDEX_LINKAGE CXSourceRange clang_Cursor_getSpellingNameRange(CXCursor,
+CINDEX_LINKAGE CXSourceRange CINDEX_CC clang_Cursor_getSpellingNameRange(CXCursor,
                                                           unsigned pieceIndex,
                                                           unsigned options);
 
@@ -3607,7 +3607,7 @@
  * such as the parameters of a function or template or the arguments of a 
  * class template specialization.
  */
-CINDEX_LINKAGE CXString clang_getCursorDisplayName(CXCursor);
+CINDEX_LINKAGE CXString CINDEX_CC clang_getCursorDisplayName(CXCursor);
   
 /** \brief For a cursor that is a reference, retrieve a cursor representing the
  * entity that it references.
@@ -3619,7 +3619,7 @@
  * definition, it returns that declaration or definition unchanged.
  * Otherwise, returns the NULL cursor.
  */
-CINDEX_LINKAGE CXCursor clang_getCursorReferenced(CXCursor);
+CINDEX_LINKAGE CXCursor CINDEX_CC clang_getCursorReferenced(CXCursor);
 
 /**
  *  \brief For a cursor that is either a reference to or a declaration
@@ -3649,13 +3649,13 @@
  *  e.g., because there is no definition of that entity within this
  *  translation unit, returns a NULL cursor.
  */
-CINDEX_LINKAGE CXCursor clang_getCursorDefinition(CXCursor);
+CINDEX_LINKAGE CXCursor CINDEX_CC clang_getCursorDefinition(CXCursor);
 
 /**
  * \brief Determine whether the declaration pointed to by this cursor
  * is also a definition of that entity.
  */
-CINDEX_LINKAGE unsigned clang_isCursorDefinition(CXCursor);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_isCursorDefinition(CXCursor);
 
 /**
  * \brief Retrieve the canonical cursor corresponding to the given cursor.
@@ -3681,7 +3681,7 @@
  *
  * \returns The canonical cursor for the entity referred to by the given cursor.
  */
-CINDEX_LINKAGE CXCursor clang_getCanonicalCursor(CXCursor);
+CINDEX_LINKAGE CXCursor CINDEX_CC clang_getCanonicalCursor(CXCursor);
 
 
 /**
@@ -3695,7 +3695,7 @@
  * expression and the cursor is pointing to a selector identifier, or -1
  * otherwise.
  */
-CINDEX_LINKAGE int clang_Cursor_getObjCSelectorIndex(CXCursor);
+CINDEX_LINKAGE int CINDEX_CC clang_Cursor_getObjCSelectorIndex(CXCursor);
 
 /**
  * \brief Given a cursor pointing to a C++ method call or an Objective-C
@@ -3708,13 +3708,13 @@
  * If the method/message is "static" or the cursor does not point to a
  * method/message, it will return zero.
  */
-CINDEX_LINKAGE int clang_Cursor_isDynamicCall(CXCursor C);
+CINDEX_LINKAGE int CINDEX_CC clang_Cursor_isDynamicCall(CXCursor C);
 
 /**
  * \brief Given a cursor pointing to an Objective-C message, returns the CXType
  * of the receiver.
  */
-CINDEX_LINKAGE CXType clang_Cursor_getReceiverType(CXCursor C);
+CINDEX_LINKAGE CXType CINDEX_CC clang_Cursor_getReceiverType(CXCursor C);
 
 /**
  * \brief Property attributes for a \c CXCursor_ObjCPropertyDecl.
@@ -3742,7 +3742,7 @@
  *
  * \param reserved Reserved for future use, pass 0.
  */
-CINDEX_LINKAGE unsigned clang_Cursor_getObjCPropertyAttributes(CXCursor C,
+CINDEX_LINKAGE unsigned CINDEX_CC clang_Cursor_getObjCPropertyAttributes(CXCursor C,
                                                              unsigned reserved);
 
 /**
@@ -3765,39 +3765,39 @@
  * type or the parameter respectively. The bits are formed from
  * CXObjCDeclQualifierKind.
  */
-CINDEX_LINKAGE unsigned clang_Cursor_getObjCDeclQualifiers(CXCursor C);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_Cursor_getObjCDeclQualifiers(CXCursor C);
 
 /**
  * \brief Given a cursor that represents an Objective-C method or property
  * declaration, return non-zero if the declaration was affected by "@optional".
  * Returns zero if the cursor is not such a declaration or it is "@required".
  */
-CINDEX_LINKAGE unsigned clang_Cursor_isObjCOptional(CXCursor C);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_Cursor_isObjCOptional(CXCursor C);
 
 /**
  * \brief Returns non-zero if the given cursor is a variadic function or method.
  */
-CINDEX_LINKAGE unsigned clang_Cursor_isVariadic(CXCursor C);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_Cursor_isVariadic(CXCursor C);
 
 /**
  * \brief Given a cursor that represents a declaration, return the associated
  * comment's source range.  The range may include multiple consecutive comments
  * with whitespace in between.
  */
-CINDEX_LINKAGE CXSourceRange clang_Cursor_getCommentRange(CXCursor C);
+CINDEX_LINKAGE CXSourceRange CINDEX_CC clang_Cursor_getCommentRange(CXCursor C);
 
 /**
  * \brief Given a cursor that represents a declaration, return the associated
  * comment text, including comment markers.
  */
-CINDEX_LINKAGE CXString clang_Cursor_getRawCommentText(CXCursor C);
+CINDEX_LINKAGE CXString CINDEX_CC clang_Cursor_getRawCommentText(CXCursor C);
 
 /**
  * \brief Given a cursor that represents a documentable entity (e.g.,
  * declaration), return the associated \\brief paragraph; otherwise return the
  * first paragraph.
  */
-CINDEX_LINKAGE CXString clang_Cursor_getBriefCommentText(CXCursor C);
+CINDEX_LINKAGE CXString CINDEX_CC clang_Cursor_getBriefCommentText(CXCursor C);
 
 /**
  * @}
@@ -3811,7 +3811,7 @@
 /**
  * \brief Retrieve the CXString representing the mangled name of the cursor.
  */
-CINDEX_LINKAGE CXString clang_Cursor_getMangling(CXCursor);
+CINDEX_LINKAGE CXString CINDEX_CC clang_Cursor_getMangling(CXCursor);
 
 /**
  * @}
@@ -3830,20 +3830,20 @@
 /**
  * \brief Given a CXCursor_ModuleImportDecl cursor, return the associated module.
  */
-CINDEX_LINKAGE CXModule clang_Cursor_getModule(CXCursor C);
+CINDEX_LINKAGE CXModule CINDEX_CC clang_Cursor_getModule(CXCursor C);
 
 /**
  * \brief Given a CXFile header file, return the module that contains it, if one
  * exists.
  */
-CINDEX_LINKAGE CXModule clang_getModuleForFile(CXTranslationUnit, CXFile);
+CINDEX_LINKAGE CXModule CINDEX_CC clang_getModuleForFile(CXTranslationUnit, CXFile);
 
 /**
  * \param Module a module object.
  *
  * \returns the module file where the provided module object came from.
  */
-CINDEX_LINKAGE CXFile clang_Module_getASTFile(CXModule Module);
+CINDEX_LINKAGE CXFile CINDEX_CC clang_Module_getASTFile(CXModule Module);
 
 /**
  * \param Module a module object.
@@ -3851,7 +3851,7 @@
  * \returns the parent of a sub-module or NULL if the given module is top-level,
  * e.g. for 'std.vector' it will return the 'std' module.
  */
-CINDEX_LINKAGE CXModule clang_Module_getParent(CXModule Module);
+CINDEX_LINKAGE CXModule CINDEX_CC clang_Module_getParent(CXModule Module);
 
 /**
  * \param Module a module object.
@@ -3859,28 +3859,28 @@
  * \returns the name of the module, e.g. for the 'std.vector' sub-module it
  * will return "vector".
  */
-CINDEX_LINKAGE CXString clang_Module_getName(CXModule Module);
+CINDEX_LINKAGE CXString CINDEX_CC clang_Module_getName(CXModule Module);
 
 /**
  * \param Module a module object.
  *
  * \returns the full name of the module, e.g. "std.vector".
  */
-CINDEX_LINKAGE CXString clang_Module_getFullName(CXModule Module);
+CINDEX_LINKAGE CXString CINDEX_CC clang_Module_getFullName(CXModule Module);
 
 /**
  * \param Module a module object.
  *
  * \returns non-zero if the module is a system one.
  */
-CINDEX_LINKAGE int clang_Module_isSystem(CXModule Module);
+CINDEX_LINKAGE int CINDEX_CC clang_Module_isSystem(CXModule Module);
 
 /**
  * \param Module a module object.
  *
  * \returns the number of top level headers associated with this module.
  */
-CINDEX_LINKAGE unsigned clang_Module_getNumTopLevelHeaders(CXTranslationUnit,
+CINDEX_LINKAGE unsigned CINDEX_CC clang_Module_getNumTopLevelHeaders(CXTranslationUnit,
                                                            CXModule Module);
 
 /**
@@ -3891,7 +3891,7 @@
  * \returns the specified top level header associated with the module.
  */
 CINDEX_LINKAGE
-CXFile clang_Module_getTopLevelHeader(CXTranslationUnit,
+CXFile CINDEX_CC clang_Module_getTopLevelHeader(CXTranslationUnit,
                                       CXModule Module, unsigned Index);
 
 /**
@@ -3911,26 +3911,26 @@
  * \brief Determine if a C++ member function or member function template is
  * pure virtual.
  */
-CINDEX_LINKAGE unsigned clang_CXXMethod_isPureVirtual(CXCursor C);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_CXXMethod_isPureVirtual(CXCursor C);
 
 /**
  * \brief Determine if a C++ member function or member function template is 
  * declared 'static'.
  */
-CINDEX_LINKAGE unsigned clang_CXXMethod_isStatic(CXCursor C);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_CXXMethod_isStatic(CXCursor C);
 
 /**
  * \brief Determine if a C++ member function or member function template is
  * explicitly declared 'virtual' or if it overrides a virtual method from
  * one of the base classes.
  */
-CINDEX_LINKAGE unsigned clang_CXXMethod_isVirtual(CXCursor C);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_CXXMethod_isVirtual(CXCursor C);
 
 /**
  * \brief Determine if a C++ member function or member function template is
  * declared 'const'.
  */
-CINDEX_LINKAGE unsigned clang_CXXMethod_isConst(CXCursor C);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_CXXMethod_isConst(CXCursor C);
 
 /**
  * \brief Given a cursor that represents a template, determine
@@ -3949,7 +3949,7 @@
  * by instantiating the template \p C. If \p C is not a template, returns
  * \c CXCursor_NoDeclFound.
  */
-CINDEX_LINKAGE enum CXCursorKind clang_getTemplateCursorKind(CXCursor C);
+CINDEX_LINKAGE enum CXCursorKind CINDEX_CC clang_getTemplateCursorKind(CXCursor C);
   
 /**
  * \brief Given a cursor that may represent a specialization or instantiation
@@ -3979,7 +3979,7 @@
  * template or a member thereof, the template or member that it specializes or
  * from which it was instantiated. Otherwise, returns a NULL cursor.
  */
-CINDEX_LINKAGE CXCursor clang_getSpecializedCursorTemplate(CXCursor C);
+CINDEX_LINKAGE CXCursor CINDEX_CC clang_getSpecializedCursorTemplate(CXCursor C);
 
 /**
  * \brief Given a cursor that references something else, return the source range
@@ -3999,7 +3999,7 @@
  * \returns The piece of the name pointed to by the given cursor. If there is no
  * name, or if the PieceIndex is out-of-range, a null-cursor will be returned.
  */
-CINDEX_LINKAGE CXSourceRange clang_getCursorReferenceNameRange(CXCursor C,
+CINDEX_LINKAGE CXSourceRange CINDEX_CC clang_getCursorReferenceNameRange(CXCursor C,
                                                 unsigned NameFlags, 
                                                 unsigned PieceIndex);
 
@@ -4084,7 +4084,7 @@
 /**
  * \brief Determine the kind of the given token.
  */
-CINDEX_LINKAGE CXTokenKind clang_getTokenKind(CXToken);
+CINDEX_LINKAGE CXTokenKind CINDEX_CC clang_getTokenKind(CXToken);
 
 /**
  * \brief Determine the spelling of the given token.
@@ -4092,18 +4092,18 @@
  * The spelling of a token is the textual representation of that token, e.g.,
  * the text of an identifier or keyword.
  */
-CINDEX_LINKAGE CXString clang_getTokenSpelling(CXTranslationUnit, CXToken);
+CINDEX_LINKAGE CXString CINDEX_CC clang_getTokenSpelling(CXTranslationUnit, CXToken);
 
 /**
  * \brief Retrieve the source location of the given token.
  */
-CINDEX_LINKAGE CXSourceLocation clang_getTokenLocation(CXTranslationUnit,
+CINDEX_LINKAGE CXSourceLocation CINDEX_CC clang_getTokenLocation(CXTranslationUnit,
                                                        CXToken);
 
 /**
  * \brief Retrieve a source range that covers the given token.
  */
-CINDEX_LINKAGE CXSourceRange clang_getTokenExtent(CXTranslationUnit, CXToken);
+CINDEX_LINKAGE CXSourceRange CINDEX_CC clang_getTokenExtent(CXTranslationUnit, CXToken);
 
 /**
  * \brief Tokenize the source code described by the given range into raw
@@ -4122,7 +4122,7 @@
  * array.
  *
  */
-CINDEX_LINKAGE void clang_tokenize(CXTranslationUnit TU, CXSourceRange Range,
+CINDEX_LINKAGE void CINDEX_CC clang_tokenize(CXTranslationUnit TU, CXSourceRange Range,
                                    CXToken **Tokens, unsigned *NumTokens);
 
 /**
@@ -4155,14 +4155,14 @@
  * \param Cursors an array of \p NumTokens cursors, whose contents will be
  * replaced with the cursors corresponding to each token.
  */
-CINDEX_LINKAGE void clang_annotateTokens(CXTranslationUnit TU,
+CINDEX_LINKAGE void CINDEX_CC clang_annotateTokens(CXTranslationUnit TU,
                                          CXToken *Tokens, unsigned NumTokens,
                                          CXCursor *Cursors);
 
 /**
  * \brief Free the given set of tokens.
  */
-CINDEX_LINKAGE void clang_disposeTokens(CXTranslationUnit TU,
+CINDEX_LINKAGE void CINDEX_CC clang_disposeTokens(CXTranslationUnit TU,
                                         CXToken *Tokens, unsigned NumTokens);
 
 /**
@@ -4179,16 +4179,16 @@
  */
 
 /* for debug/testing */
-CINDEX_LINKAGE CXString clang_getCursorKindSpelling(enum CXCursorKind Kind);
-CINDEX_LINKAGE void clang_getDefinitionSpellingAndExtent(CXCursor,
+CINDEX_LINKAGE CXString CINDEX_CC clang_getCursorKindSpelling(enum CXCursorKind Kind);
+CINDEX_LINKAGE void CINDEX_CC clang_getDefinitionSpellingAndExtent(CXCursor,
                                           const char **startBuf,
                                           const char **endBuf,
                                           unsigned *startLine,
                                           unsigned *startColumn,
                                           unsigned *endLine,
                                           unsigned *endColumn);
-CINDEX_LINKAGE void clang_enableStackTraces(void);
-CINDEX_LINKAGE void clang_executeOnThread(void (*fn)(void*), void *user_data,
+CINDEX_LINKAGE void CINDEX_CC clang_enableStackTraces(void);
+CINDEX_LINKAGE void CINDEX_CC clang_executeOnThread(void (*fn)(void*), void *user_data,
                                           unsigned stack_size);
 
 /**
@@ -4426,7 +4426,7 @@
  * \returns the kind of the chunk at the index \c chunk_number.
  */
 CINDEX_LINKAGE enum CXCompletionChunkKind
-clang_getCompletionChunkKind(CXCompletionString completion_string,
+CINDEX_CC clang_getCompletionChunkKind(CXCompletionString completion_string,
                              unsigned chunk_number);
 
 /**
@@ -4440,7 +4440,7 @@
  * \returns the text associated with the chunk at index \c chunk_number.
  */
 CINDEX_LINKAGE CXString
-clang_getCompletionChunkText(CXCompletionString completion_string,
+CINDEX_CC clang_getCompletionChunkText(CXCompletionString completion_string,
                              unsigned chunk_number);
 
 /**
@@ -4455,14 +4455,14 @@
  * \c chunk_number.
  */
 CINDEX_LINKAGE CXCompletionString
-clang_getCompletionChunkCompletionString(CXCompletionString completion_string,
+CINDEX_CC clang_getCompletionChunkCompletionString(CXCompletionString completion_string,
                                          unsigned chunk_number);
 
 /**
  * \brief Retrieve the number of chunks in the given code-completion string.
  */
 CINDEX_LINKAGE unsigned
-clang_getNumCompletionChunks(CXCompletionString completion_string);
+CINDEX_CC clang_getNumCompletionChunks(CXCompletionString completion_string);
 
 /**
  * \brief Determine the priority of this code completion.
@@ -4477,7 +4477,7 @@
  * higher-priority (more likely) completions.
  */
 CINDEX_LINKAGE unsigned
-clang_getCompletionPriority(CXCompletionString completion_string);
+CINDEX_CC clang_getCompletionPriority(CXCompletionString completion_string);
   
 /**
  * \brief Determine the availability of the entity that this code-completion
@@ -4488,7 +4488,7 @@
  * \returns The availability of the completion string.
  */
 CINDEX_LINKAGE enum CXAvailabilityKind 
-clang_getCompletionAvailability(CXCompletionString completion_string);
+CINDEX_CC clang_getCompletionAvailability(CXCompletionString completion_string);
 
 /**
  * \brief Retrieve the number of annotations associated with the given
@@ -4500,7 +4500,7 @@
  * string.
  */
 CINDEX_LINKAGE unsigned
-clang_getCompletionNumAnnotations(CXCompletionString completion_string);
+CINDEX_CC clang_getCompletionNumAnnotations(CXCompletionString completion_string);
 
 /**
  * \brief Retrieve the annotation associated with the given completion string.
@@ -4514,7 +4514,7 @@
  * \c annotation_number, or a NULL string if that annotation is not available.
  */
 CINDEX_LINKAGE CXString
-clang_getCompletionAnnotation(CXCompletionString completion_string,
+CINDEX_CC clang_getCompletionAnnotation(CXCompletionString completion_string,
                               unsigned annotation_number);
 
 /**
@@ -4534,7 +4534,7 @@
  * the completion string represents a method in the NSObject class.
  */
 CINDEX_LINKAGE CXString
-clang_getCompletionParent(CXCompletionString completion_string,
+CINDEX_CC clang_getCompletionParent(CXCompletionString completion_string,
                           enum CXCursorKind *kind);
 
 /**
@@ -4542,7 +4542,7 @@
  * that corresponds to the given completion string.
  */
 CINDEX_LINKAGE CXString
-clang_getCompletionBriefComment(CXCompletionString completion_string);
+CINDEX_CC clang_getCompletionBriefComment(CXCompletionString completion_string);
 
 /**
  * \brief Retrieve a completion string for an arbitrary declaration or macro
@@ -4554,7 +4554,7 @@
  * definition cursors, or NULL for other kinds of cursors.
  */
 CINDEX_LINKAGE CXCompletionString
-clang_getCursorCompletionString(CXCursor cursor);
+CINDEX_CC clang_getCursorCompletionString(CXCursor cursor);
   
 /**
  * \brief Contains the results of code-completion.
@@ -4738,7 +4738,7 @@
  * \brief Returns a default set of code-completion options that can be
  * passed to\c clang_codeCompleteAt(). 
  */
-CINDEX_LINKAGE unsigned clang_defaultCodeCompleteOptions(void);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_defaultCodeCompleteOptions(void);
 
 /**
  * \brief Perform code completion at a given location in a translation unit.
@@ -4809,7 +4809,7 @@
  * completion fails, returns NULL.
  */
 CINDEX_LINKAGE
-CXCodeCompleteResults *clang_codeCompleteAt(CXTranslationUnit TU,
+CXCodeCompleteResults * CINDEX_CC clang_codeCompleteAt(CXTranslationUnit TU,
                                             const char *complete_filename,
                                             unsigned complete_line,
                                             unsigned complete_column,
@@ -4825,21 +4825,21 @@
  * \param NumResults The number of results in \p Results.
  */
 CINDEX_LINKAGE
-void clang_sortCodeCompletionResults(CXCompletionResult *Results,
+void CINDEX_CC clang_sortCodeCompletionResults(CXCompletionResult *Results,
                                      unsigned NumResults);
   
 /**
  * \brief Free the given set of code-completion results.
  */
 CINDEX_LINKAGE
-void clang_disposeCodeCompleteResults(CXCodeCompleteResults *Results);
+void CINDEX_CC clang_disposeCodeCompleteResults(CXCodeCompleteResults *Results);
   
 /**
  * \brief Determine the number of diagnostics produced prior to the
  * location where code completion was performed.
  */
 CINDEX_LINKAGE
-unsigned clang_codeCompleteGetNumDiagnostics(CXCodeCompleteResults *Results);
+unsigned CINDEX_CC clang_codeCompleteGetNumDiagnostics(CXCodeCompleteResults *Results);
 
 /**
  * \brief Retrieve a diagnostic associated with the given code completion.
@@ -4851,7 +4851,7 @@
  * via a call to \c clang_disposeDiagnostic().
  */
 CINDEX_LINKAGE
-CXDiagnostic clang_codeCompleteGetDiagnostic(CXCodeCompleteResults *Results,
+CXDiagnostic CINDEX_CC clang_codeCompleteGetDiagnostic(CXCodeCompleteResults *Results,
                                              unsigned Index);
 
 /**
@@ -4864,7 +4864,7 @@
  * along with the given code completion results.
  */
 CINDEX_LINKAGE
-unsigned long long clang_codeCompleteGetContexts(
+unsigned long long CINDEX_CC clang_codeCompleteGetContexts(
                                                 CXCodeCompleteResults *Results);
 
 /**
@@ -4884,7 +4884,7 @@
  * container
  */
 CINDEX_LINKAGE
-enum CXCursorKind clang_codeCompleteGetContainerKind(
+enum CXCursorKind CINDEX_CC clang_codeCompleteGetContainerKind(
                                                  CXCodeCompleteResults *Results,
                                                      unsigned *IsIncomplete);
 
@@ -4898,7 +4898,7 @@
  * \returns the USR for the container
  */
 CINDEX_LINKAGE
-CXString clang_codeCompleteGetContainerUSR(CXCodeCompleteResults *Results);
+CXString CINDEX_CC clang_codeCompleteGetContainerUSR(CXCodeCompleteResults *Results);
   
   
 /**
@@ -4913,7 +4913,7 @@
  * for an Objective-C message send.
  */
 CINDEX_LINKAGE
-CXString clang_codeCompleteGetObjCSelector(CXCodeCompleteResults *Results);
+CXString CINDEX_CC clang_codeCompleteGetObjCSelector(CXCodeCompleteResults *Results);
   
 /**
  * @}
@@ -4930,7 +4930,7 @@
  * \brief Return a version string, suitable for showing to a user, but not
  *        intended to be parsed (the format is not guaranteed to be stable).
  */
-CINDEX_LINKAGE CXString clang_getClangVersion(void);
+CINDEX_LINKAGE CXString CINDEX_CC clang_getClangVersion(void);
 
   
 /**
@@ -4939,7 +4939,7 @@
  * \param isEnabled Flag to indicate if crash recovery is enabled.  A non-zero
  *        value enables crash recovery, while 0 disables it.
  */
-CINDEX_LINKAGE void clang_toggleCrashRecovery(unsigned isEnabled);
+CINDEX_LINKAGE void CINDEX_CC clang_toggleCrashRecovery(unsigned isEnabled);
   
  /**
   * \brief Visitor invoked for each file in a translation unit
@@ -4989,7 +4989,7 @@
  * \returns the requested remapping. This remapping must be freed
  * via a call to \c clang_remap_dispose(). Can return NULL if an error occurred.
  */
-CINDEX_LINKAGE CXRemapping clang_getRemappings(const char *path);
+CINDEX_LINKAGE CXRemapping CINDEX_CC clang_getRemappings(const char *path);
 
 /**
  * \brief Retrieve a remapping.
@@ -5002,13 +5002,13 @@
  * via a call to \c clang_remap_dispose(). Can return NULL if an error occurred.
  */
 CINDEX_LINKAGE
-CXRemapping clang_getRemappingsFromFileList(const char **filePaths,
+CXRemapping CINDEX_CC clang_getRemappingsFromFileList(const char **filePaths,
                                             unsigned numFiles);
 
 /**
  * \brief Determine the number of remappings.
  */
-CINDEX_LINKAGE unsigned clang_remap_getNumFiles(CXRemapping);
+CINDEX_LINKAGE unsigned CINDEX_CC clang_remap_getNumFiles(CXRemapping);
 
 /**
  * \brief Get the original and the associated filename from the remapping.
@@ -5018,13 +5018,13 @@
  * \param transformed If non-NULL, will be set to the filename that the original
  * is associated with.
  */
-CINDEX_LINKAGE void clang_remap_getFilenames(CXRemapping, unsigned index,
+CINDEX_LINKAGE void CINDEX_CC clang_remap_getFilenames(CXRemapping, unsigned index,
                                      CXString *original, CXString *transformed);
 
 /**
  * \brief Dispose the remapping.
  */
-CINDEX_LINKAGE void clang_remap_dispose(CXRemapping);
+CINDEX_LINKAGE void CINDEX_CC clang_remap_dispose(CXRemapping);
 
 /**
  * @}
@@ -5076,7 +5076,7 @@
  *
  * \returns one of the CXResult enumerators.
  */
-CINDEX_LINKAGE CXResult clang_findReferencesInFile(CXCursor cursor, CXFile file,
+CINDEX_LINKAGE CXResult CINDEX_CC clang_findReferencesInFile(CXCursor cursor, CXFile file,
                                                CXCursorAndRangeVisitor visitor);
 
 /**
@@ -5091,7 +5091,7 @@
  *
  * \returns one of the CXResult enumerators.
  */
-CINDEX_LINKAGE CXResult clang_findIncludesInFile(CXTranslationUnit TU,
+CINDEX_LINKAGE CXResult CINDEX_CC clang_findIncludesInFile(CXTranslationUnit TU,
                                                  CXFile file,
                                               CXCursorAndRangeVisitor visitor);
 
@@ -5102,11 +5102,11 @@
     (^CXCursorAndRangeVisitorBlock)(CXCursor, CXSourceRange);
 
 CINDEX_LINKAGE
-CXResult clang_findReferencesInFileWithBlock(CXCursor, CXFile,
+CXResult CINDEX_CC clang_findReferencesInFileWithBlock(CXCursor, CXFile,
                                              CXCursorAndRangeVisitorBlock);
 
 CINDEX_LINKAGE
-CXResult clang_findIncludesInFileWithBlock(CXTranslationUnit, CXFile,
+CXResult CINDEX_CC clang_findIncludesInFileWithBlock(CXTranslationUnit, CXFile,
                                            CXCursorAndRangeVisitorBlock);
 
 #  endif
@@ -5470,54 +5470,54 @@
 
 } IndexerCallbacks;
 
-CINDEX_LINKAGE int clang_index_isEntityObjCContainerKind(CXIdxEntityKind);
+CINDEX_LINKAGE int CINDEX_CC clang_index_isEntityObjCContainerKind(CXIdxEntityKind);
 CINDEX_LINKAGE const CXIdxObjCContainerDeclInfo *
-clang_index_getObjCContainerDeclInfo(const CXIdxDeclInfo *);
+CINDEX_CC clang_index_getObjCContainerDeclInfo(const CXIdxDeclInfo *);
 
 CINDEX_LINKAGE const CXIdxObjCInterfaceDeclInfo *
-clang_index_getObjCInterfaceDeclInfo(const CXIdxDeclInfo *);
+CINDEX_CC clang_index_getObjCInterfaceDeclInfo(const CXIdxDeclInfo *);
 
 CINDEX_LINKAGE
 const CXIdxObjCCategoryDeclInfo *
-clang_index_getObjCCategoryDeclInfo(const CXIdxDeclInfo *);
+CINDEX_CC clang_index_getObjCCategoryDeclInfo(const CXIdxDeclInfo *);
 
 CINDEX_LINKAGE const CXIdxObjCProtocolRefListInfo *
-clang_index_getObjCProtocolRefListInfo(const CXIdxDeclInfo *);
+CINDEX_CC clang_index_getObjCProtocolRefListInfo(const CXIdxDeclInfo *);
 
 CINDEX_LINKAGE const CXIdxObjCPropertyDeclInfo *
-clang_index_getObjCPropertyDeclInfo(const CXIdxDeclInfo *);
+CINDEX_CC clang_index_getObjCPropertyDeclInfo(const CXIdxDeclInfo *);
 
 CINDEX_LINKAGE const CXIdxIBOutletCollectionAttrInfo *
-clang_index_getIBOutletCollectionAttrInfo(const CXIdxAttrInfo *);
+CINDEX_CC clang_index_getIBOutletCollectionAttrInfo(const CXIdxAttrInfo *);
 
 CINDEX_LINKAGE const CXIdxCXXClassDeclInfo *
-clang_index_getCXXClassDeclInfo(const CXIdxDeclInfo *);
+CINDEX_CC clang_index_getCXXClassDeclInfo(const CXIdxDeclInfo *);
 
 /**
  * \brief For retrieving a custom CXIdxClientContainer attached to a
  * container.
  */
 CINDEX_LINKAGE CXIdxClientContainer
-clang_index_getClientContainer(const CXIdxContainerInfo *);
+CINDEX_CC clang_index_getClientContainer(const CXIdxContainerInfo *);
 
 /**
  * \brief For setting a custom CXIdxClientContainer attached to a
  * container.
  */
 CINDEX_LINKAGE void
-clang_index_setClientContainer(const CXIdxContainerInfo *,CXIdxClientContainer);
+CINDEX_CC clang_index_setClientContainer(const CXIdxContainerInfo *,CXIdxClientContainer);
 
 /**
  * \brief For retrieving a custom CXIdxClientEntity attached to an entity.
  */
 CINDEX_LINKAGE CXIdxClientEntity
-clang_index_getClientEntity(const CXIdxEntityInfo *);
+CINDEX_CC clang_index_getClientEntity(const CXIdxEntityInfo *);
 
 /**
  * \brief For setting a custom CXIdxClientEntity attached to an entity.
  */
 CINDEX_LINKAGE void
-clang_index_setClientEntity(const CXIdxEntityInfo *, CXIdxClientEntity);
+CINDEX_CC clang_index_setClientEntity(const CXIdxEntityInfo *, CXIdxClientEntity);
 
 /**
  * \brief An indexing action/session, to be applied to one or multiple
@@ -5531,7 +5531,7 @@
  *
  * \param CIdx The index object with which the index action will be associated.
  */
-CINDEX_LINKAGE CXIndexAction clang_IndexAction_create(CXIndex CIdx);
+CINDEX_LINKAGE CXIndexAction CINDEX_CC clang_IndexAction_create(CXIndex CIdx);
 
 /**
  * \brief Destroy the given index action.
@@ -5539,7 +5539,7 @@
  * The index action must not be destroyed until all of the translation units
  * created within that index action have been destroyed.
  */
-CINDEX_LINKAGE void clang_IndexAction_dispose(CXIndexAction);
+CINDEX_LINKAGE void CINDEX_CC clang_IndexAction_dispose(CXIndexAction);
 
 typedef enum {
   /**
@@ -5605,7 +5605,7 @@
  *
  * The rest of the parameters are the same as #clang_parseTranslationUnit.
  */
-CINDEX_LINKAGE int clang_indexSourceFile(CXIndexAction,
+CINDEX_LINKAGE int CINDEX_CC clang_indexSourceFile(CXIndexAction,
                                          CXClientData client_data,
                                          IndexerCallbacks *index_callbacks,
                                          unsigned index_callbacks_size,
@@ -5634,7 +5634,7 @@
  * \returns If there is a failure from which the there is no recovery, returns
  * non-zero, otherwise returns 0.
  */
-CINDEX_LINKAGE int clang_indexTranslationUnit(CXIndexAction,
+CINDEX_LINKAGE int CINDEX_CC clang_indexTranslationUnit(CXIndexAction,
                                               CXClientData client_data,
                                               IndexerCallbacks *index_callbacks,
                                               unsigned index_callbacks_size,
@@ -5649,7 +5649,7 @@
  * location of the macro expansion and if it refers into a macro argument
  * retrieves the location of the argument.
  */
-CINDEX_LINKAGE void clang_indexLoc_getFileLocation(CXIdxLoc loc,
+CINDEX_LINKAGE void CINDEX_CC clang_indexLoc_getFileLocation(CXIdxLoc loc,
                                                    CXIdxClientFile *indexFile,
                                                    CXFile *file,
                                                    unsigned *line,
@@ -5660,7 +5660,7 @@
  * \brief Retrieve the CXSourceLocation represented by the given CXIdxLoc.
  */
 CINDEX_LINKAGE
-CXSourceLocation clang_indexLoc_getCXSourceLocation(CXIdxLoc loc);
+CXSourceLocation CINDEX_CC clang_indexLoc_getCXSourceLocation(CXIdxLoc loc);
 
 /**
  * @}
Index: Platform.h
===================================================================
--- Platform.h	(revision 219844)
+++ Platform.h	(working copy)
@@ -33,12 +33,18 @@
   #define CINDEX_DEPRECATED __attribute__((deprecated))
 #else
   #ifdef _MSC_VER
-    #define CINDEX_DEPRECATED __declspec(deprecated)
+	#define CINDEX_DEPRECATED __declspec(deprecated)
   #else
-    #define CINDEX_DEPRECATED
+	#define CINDEX_DEPRECATED
   #endif
 #endif
 
+#ifdef __BORLANDC__
+  #define CINDEX_CC __msreturn
+#else
+  #define CINDEX_CC
+#endif
+
 #ifdef __cplusplus
 }
 #endif


More information about the cfe-commits mailing list