This repository contains java bindings for Clang 3.3. All java files were auto generated using JNAerator and reformated with IntelliJ.
Original clang c bindings are placed in src/main/c/clang-c directory.
JNAerator configuration file you can find in src/main/jnaerator/conf.jnaerator.
All generated java bindings are in src/main/java/clang.
Purpose of this project is not only to provide bindings for Clang 3.3 but also to create simple structure
which allow you to regenerate all java files in case of Clang update.
To do that you need to copy llvm/tools/clang/include/clang-c directory to src/main/c/clang-c, update conf.jnaerator
with recent list of clang-c headers and call:
mvn install
Unlucky sources reification in JNAerator doesnt work too good so java API which we gets is very c-style. Manual changes doesn't make big sense here, it would be tedious task to adjust API every time we want to use new Clang version. It's not only error prone but also it would be hard to maintain consistency between versions. If we want to do that, we need two things:
- higher lever java API which will be using our autogenerated java classes (it will be much easier to update)
- some generator for writing higher lever java API automatically, at least skeleton
To handle dependencies properly we can also use c++ files from llvm/tools/clang/tools/libclang. For very basic example you can look at script in bin directory, which takes path to llvm/tools/clang/tools/libclang as parameter and checks which C API functions are defined in cpp files:
.bin/function_locator.sh $(LLVM_HOME)/llvm/tools/clang/tools/libclang
Output:
----- llvm/tools/clang/tools/libclang/ARCMigrate.cpp -----
clang_getRemappings
clang_remap_dispose
clang_remap_getNumFiles
----- llvm/tools/clang/tools/libclang/CIndex.cpp -----
clang_CXIndex_getGlobalOptions
clang_CXIndex_setGlobalOptions
clang_CXXMethod_isStatic
clang_CXXMethod_isVirtual
clang_Cursor_getBriefCommentText
clang_Cursor_getCommentRange
clang_Cursor_getParsedComment
clang_Cursor_getRawCommentText
clang_Cursor_getObjCSelectorIndex
clang_Cursor_getModule
clang_Module_getParent
clang_Module_getName
clang_Module_getFullName
clang_Module_getNumTopLevelHeaders
clang_Module_getTopLevelHeader
clang_annotateTokens
clang_defaultEditingTranslationUnitOptions
clang_defaultReparseOptions
clang_defaultSaveOptions
clang_disposeCXTUResourceUsage
clang_disposeIndex
clang_disposeCXPlatformAvailability
clang_disposeTranslationUnit
clang_enableStackTraces
clang_equalCursors
clang_getCXTUResourceUsage
clang_getCanonicalCursor
clang_getClangVersion
clang_getCursor
clang_getCursorAvailability
clang_getCursorDefinition
clang_getCursorDisplayName
clang_getCursorExtent
clang_getCursorKind
clang_getCursorKindSpelling
clang_getCursorLanguage
clang_getCursorLexicalParent
clang_getCursorLinkage
clang_getCursorLocation
clang_getCursorReferenced
clang_getCursorSemanticParent
clang_getCursorSpelling
clang_getFile
clang_getFileName
clang_getFileTime
clang_getIBOutletCollectionType
clang_getIncludedFile
clang_getNullCursor
clang_getNumOverloadedDecls
clang_getOverloadedDecl
clang_getTUResourceUsageName
clang_getTokenExtent
clang_getTokenKind
clang_getTokenLocation
clang_getTokenSpelling
clang_getTranslationUnitCursor
clang_getTranslationUnitSpelling
clang_hashCursor
clang_isAttribute
clang_isCursorDefinition
clang_isDeclaration
clang_isExpression
clang_isFileMultipleIncludeGuarded
clang_isInvalid
clang_isPreprocessing
clang_isReference
clang_isStatement
clang_isTranslationUnit
clang_isUnexposed
clang_parseTranslationUnit
clang_reparseTranslationUnit
clang_saveTranslationUnit
clang_toggleCrashRecovery
----- llvm/tools/clang/tools/libclang/CIndexCXX.cpp -----
clang_getCXXAccessSpecifier
clang_getSpecializedCursorTemplate
clang_getTemplateCursorKind
clang_isVirtualBase
----- llvm/tools/clang/tools/libclang/CIndexCodeCompletion.cpp -----
clang_codeCompleteAt
clang_codeCompleteGetContainerUSR
clang_codeCompleteGetContexts
clang_codeCompleteGetNumDiagnostics
clang_codeCompleteGetObjCSelector
clang_defaultCodeCompleteOptions
clang_disposeCodeCompleteResults
clang_getCompletionAvailability
clang_getCompletionBriefComment
clang_getCompletionPriority
clang_getNumCompletionChunks
----- llvm/tools/clang/tools/libclang/CIndexDiagnostic.cpp -----
clang_defaultDiagnosticDisplayOptions
clang_disposeDiagnostic
clang_disposeDiagnosticSet
clang_formatDiagnostic
clang_getChildDiagnostics
clang_getDiagnostic
clang_getDiagnosticCategory
clang_getDiagnosticCategoryName
clang_getDiagnosticCategoryText
clang_getDiagnosticLocation
clang_getDiagnosticNumFixIts
clang_getDiagnosticNumRanges
clang_getDiagnosticOption
clang_getDiagnosticRange
clang_getDiagnosticSetFromTU
clang_getDiagnosticSeverity
clang_getDiagnosticSpelling
clang_getNumDiagnostics
clang_getNumDiagnosticsInSet
----- llvm/tools/clang/tools/libclang/CIndexHigh.cpp -----
----- llvm/tools/clang/tools/libclang/CIndexInclusionStack.cpp -----
----- /home/kuki/work/llvm/tools/clang/tools/libclang/CIndexUSRs.cpp -----
clang_constructUSR_ObjCClass
clang_constructUSR_ObjCIvar
clang_constructUSR_ObjCProtocol
clang_getCursor
clang_getCursorUSR
----- llvm/tools/clang/tools/libclang/CIndexer.cpp -----
----- llvm/tools/clang/tools/libclang/CXComment.cpp -----
clang_Comment_getKind
clang_Comment_getNumChildren
clang_Comment_getChild
clang_Comment_isWhitespace
clang_InlineContentComment_hasTrailingNewline
clang_TextComment_getText
clang_InlineCommandComment_getCommandName
clang_InlineCommandComment_getRenderKind
clang_InlineCommandComment_getNumArgs
clang_HTMLTagComment_getTagName
clang_HTMLStartTagComment_isSelfClosing
clang_HTMLStartTag_getNumAttrs
clang_HTMLStartTag_getAttrName
clang_HTMLStartTag_getAttrValue
clang_BlockCommandComment_getCommandName
clang_BlockCommandComment_getNumArgs
clang_BlockCommandComment_getParagraph
clang_ParamCommandComment_getParamName
clang_ParamCommandComment_isParamIndexValid
clang_ParamCommandComment_getParamIndex
clang_ParamCommandComment_isDirectionExplicit
clang_TParamCommandComment_getParamName
clang_TParamCommandComment_isParamPositionValid
clang_TParamCommandComment_getDepth
clang_TParamCommandComment_getIndex
clang_VerbatimBlockLineComment_getText
clang_VerbatimLineComment_getText
clang_HTMLTagComment_getAsString
clang_FullComment_getAsHTML
clang_FullComment_getAsXML
----- llvm/tools/clang/tools/libclang/CXCompilationDatabase.cpp -----
clang_CompilationDatabase_getAllCompileCommands
----- llvm/tools/clang/tools/libclang/CXCursor.cpp -----
clang_CXCursorSet_contains
clang_CXCursorSet_insert
clang_Cursor_getArgument
clang_Cursor_getNumArguments
clang_Cursor_getTranslationUnit
clang_Cursor_getReceiverType
clang_Cursor_isDynamicCall
clang_Cursor_isNull
clang_createCXCursorSet
clang_disposeCXCursorSet
clang_disposeOverriddenCursors
clang_getCursor
clang_getCursorCompletionString
----- llvm/tools/clang/tools/libclang/CXLoadedDiagnostic.cpp -----
----- llvm/tools/clang/tools/libclang/CXSourceLocation.cpp -----
clang_Range_isNull
clang_equalLocations
clang_equalRanges
clang_getNullLocation
clang_getNullRange
clang_getRange
clang_getRangeEnd
clang_getRangeStart