[clang] c7b3a91 - libclang.so: Make SONAME independent from LLVM version

Tom Stellard via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 26 16:37:42 PDT 2021


Author: Tom Stellard
Date: 2021-07-26T16:37:26-07:00
New Revision: c7b3a91017d26266d7556b1ac7c49b06f0109b91

URL: https://github.com/llvm/llvm-project/commit/c7b3a91017d26266d7556b1ac7c49b06f0109b91
DIFF: https://github.com/llvm/llvm-project/commit/c7b3a91017d26266d7556b1ac7c49b06f0109b91.diff

LOG: libclang.so: Make SONAME independent from LLVM version

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D105527

Added: 
    clang/test/LibClang/lit.local.cfg
    clang/test/LibClang/symbols.test
    clang/tools/libclang/libclang.map
    clang/tools/libclang/linker-script-to-export-list.py

Modified: 
    clang/test/CMakeLists.txt
    clang/test/lit.site.cfg.py.in
    clang/tools/libclang/CMakeLists.txt

Removed: 
    clang/tools/libclang/libclang.exports


################################################################################
diff  --git a/clang/test/CMakeLists.txt b/clang/test/CMakeLists.txt
index 52a3a3b761af0..9bf791f93f32e 100644
--- a/clang/test/CMakeLists.txt
+++ b/clang/test/CMakeLists.txt
@@ -37,6 +37,7 @@ configure_lit_site_cfg(
   "CLANG_BINARY_DIR"
   "CLANG_SOURCE_DIR"
   "CLANG_TOOLS_DIR"
+  "CMAKE_LIBRARY_OUTPUT_DIRECTORY"
   )
 
 configure_lit_site_cfg(

diff  --git a/clang/test/LibClang/lit.local.cfg b/clang/test/LibClang/lit.local.cfg
new file mode 100644
index 0000000000000..588f0ac749974
--- /dev/null
+++ b/clang/test/LibClang/lit.local.cfg
@@ -0,0 +1,2 @@
+config.substitutions.append(('%libclang', os.path.join(config.clang_lib_dir, 'libclang.so')))
+config.pipefail = False

diff  --git a/clang/test/LibClang/symbols.test b/clang/test/LibClang/symbols.test
new file mode 100644
index 0000000000000..fd2ff8bc6cd42
--- /dev/null
+++ b/clang/test/LibClang/symbols.test
@@ -0,0 +1,6 @@
+# Check that there are no unversioned clang symbols in libclang.so
+RUN: llvm-nm -Dj --defined-only %libclang | grep -v -e '@@LLVM_[0-9]\+$' | not grep '^clang'
+
+# Check that here are no local clang_ symbols (ignoring symbols with .cold or
+# .localalias suffxies.)
+RUN: llvm-nm %libclang | not grep '[a-z] clang_[^.]\+$'

diff  --git a/clang/test/lit.site.cfg.py.in b/clang/test/lit.site.cfg.py.in
index 7b174e681bf34..a99550c3f909a 100644
--- a/clang/test/lit.site.cfg.py.in
+++ b/clang/test/lit.site.cfg.py.in
@@ -14,6 +14,7 @@ config.clang_lit_site_cfg = __file__
 config.clang_obj_root = path(r"@CLANG_BINARY_DIR@")
 config.clang_src_dir = path(r"@CLANG_SOURCE_DIR@")
 config.clang_tools_dir = path(r"@CLANG_TOOLS_DIR@")
+config.clang_lib_dir = path(r"@CMAKE_LIBRARY_OUTPUT_DIRECTORY@")
 config.host_triple = "@LLVM_HOST_TRIPLE@"
 config.target_triple = "@TARGET_TRIPLE@"
 config.host_cc = "@CMAKE_C_COMPILER@"

diff  --git a/clang/tools/libclang/CMakeLists.txt b/clang/tools/libclang/CMakeLists.txt
index 8fde9aed01913..f5297ba539668 100644
--- a/clang/tools/libclang/CMakeLists.txt
+++ b/clang/tools/libclang/CMakeLists.txt
@@ -65,6 +65,7 @@ option(LIBCLANG_BUILD_STATIC
   "Build libclang as a static library (in addition to a shared one)" OFF)
 
 set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/libclang.exports)
+set(LIBCLANG_VERSION_SCRIPT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/libclang.map)
 
 if(MSVC)
   # Avoid LNK4197 by not specifying libclang.exports here.
@@ -73,6 +74,20 @@ if(MSVC)
   set(LLVM_EXPORTED_SYMBOL_FILE)
 endif()
 
+if (UNIX AND NOT APPLE)
+  set(LLVM_EXPORTED_SYMBOL_FILE)
+  set(USE_VERSION_SCRIPT TRUE)
+endif()
+
+if (LLVM_EXPORTED_SYMBOL_FILE)
+  add_custom_command(OUTPUT ${LLVM_EXPORTED_SYMBOL_FILE}
+                     COMMAND "${Python3_EXECUTABLE}"
+                       ARGS ${CMAKE_CURRENT_SOURCE_DIR}/linker-script-to-export-list.py
+                            ${LIBCLANG_VERSION_SCRIPT_FILE}
+                            ${LLVM_EXPORTED_SYMBOL_FILE}
+                     DEPENDS ${LIBCLANG_VERSION_SCRIPT_FILE})
+endif()
+
 if(LLVM_ENABLE_PIC OR (WIN32 AND NOT LIBCLANG_BUILD_STATIC))
   set(ENABLE_SHARED SHARED)
 endif()
@@ -145,6 +160,19 @@ if(ENABLE_SHARED)
         )
     endif()
   endif()
+  if (USE_VERSION_SCRIPT)
+    target_link_options(libclang PRIVATE "-Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/libclang.map")
+    # Ensure that libclang.so gets rebuilt when the linker script changes.
+    set_property(SOURCE ARCMigrate.cpp APPEND PROPERTY
+                 OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libclang.map)
+
+    # The SOVERSION should be updated only if a change is made to the libclang
+    # ABI, and when it is updated, it should be updated to the current
+    # LLVM_VERSION_MAJOR.
+    set_target_properties(libclang PROPERTIES
+                          VERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}${LLVM_VERSION_SUFFIX}
+                          SOVERSION 13)
+  endif()
 endif()
 
 if(INTERNAL_INSTALL_PREFIX)

diff  --git a/clang/tools/libclang/libclang.exports b/clang/tools/libclang/libclang.exports
deleted file mode 100644
index 528424713a9a5..0000000000000
--- a/clang/tools/libclang/libclang.exports
+++ /dev/null
@@ -1,394 +0,0 @@
-clang_CXCursorSet_contains
-clang_CXCursorSet_insert
-clang_CXIndex_getGlobalOptions
-clang_CXIndex_setGlobalOptions
-clang_CXIndex_setInvocationEmissionPathOption
-clang_CXXConstructor_isConvertingConstructor
-clang_CXXConstructor_isCopyConstructor
-clang_CXXConstructor_isDefaultConstructor
-clang_CXXConstructor_isMoveConstructor
-clang_CXXField_isMutable
-clang_CXXMethod_isDefaulted
-clang_CXXMethod_isConst
-clang_CXXMethod_isPureVirtual
-clang_CXXMethod_isStatic
-clang_CXXMethod_isVirtual
-clang_CXXRecord_isAbstract
-clang_EnumDecl_isScoped
-clang_Cursor_getArgument
-clang_Cursor_getNumTemplateArguments
-clang_Cursor_getTemplateArgumentKind
-clang_Cursor_getTemplateArgumentType
-clang_Cursor_getTemplateArgumentValue
-clang_Cursor_getTemplateArgumentUnsignedValue
-clang_Cursor_getBriefCommentText
-clang_Cursor_getCommentRange
-clang_Cursor_getCXXManglings
-clang_Cursor_getMangling
-clang_Cursor_getObjCManglings
-clang_Cursor_getParsedComment
-clang_Cursor_getRawCommentText
-clang_Cursor_getNumArguments
-clang_Cursor_getObjCDeclQualifiers
-clang_Cursor_getObjCPropertyAttributes
-clang_Cursor_getObjCPropertyGetterName
-clang_Cursor_getObjCPropertySetterName
-clang_Cursor_getObjCSelectorIndex
-clang_Cursor_getOffsetOfField
-clang_Cursor_getSpellingNameRange
-clang_Cursor_getTranslationUnit
-clang_Cursor_getReceiverType
-clang_Cursor_isAnonymous
-clang_Cursor_isAnonymousRecordDecl
-clang_Cursor_isBitField
-clang_Cursor_isDynamicCall
-clang_Cursor_isExternalSymbol
-clang_Cursor_isInlineNamespace
-clang_Cursor_isNull
-clang_Cursor_isObjCOptional
-clang_Cursor_isVariadic
-clang_Cursor_getModule
-clang_Cursor_getStorageClass
-clang_File_isEqual
-clang_File_tryGetRealPathName
-clang_Module_getASTFile
-clang_Module_getParent
-clang_Module_getName
-clang_Module_getFullName
-clang_Module_getNumTopLevelHeaders
-clang_Module_getTopLevelHeader
-clang_Module_isSystem
-clang_IndexAction_create
-clang_IndexAction_dispose
-clang_Range_isNull
-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_InlineCommandComment_getArgText
-clang_HTMLTagComment_getTagName
-clang_HTMLStartTagComment_isSelfClosing
-clang_HTMLStartTag_getNumAttrs
-clang_HTMLStartTag_getAttrName
-clang_HTMLStartTag_getAttrValue
-clang_BlockCommandComment_getCommandName
-clang_BlockCommandComment_getNumArgs
-clang_BlockCommandComment_getArgText
-clang_BlockCommandComment_getParagraph
-clang_ParamCommandComment_getParamName
-clang_ParamCommandComment_isParamIndexValid
-clang_ParamCommandComment_getParamIndex
-clang_ParamCommandComment_isDirectionExplicit
-clang_ParamCommandComment_getDirection
-clang_TParamCommandComment_getParamName
-clang_TParamCommandComment_isParamPositionValid
-clang_TParamCommandComment_getDepth
-clang_TParamCommandComment_getIndex
-clang_TargetInfo_dispose
-clang_TargetInfo_getPointerWidth
-clang_TargetInfo_getTriple
-clang_Type_getAlignOf
-clang_Type_getClassType
-clang_Type_getSizeOf
-clang_Type_getOffsetOf
-clang_Type_getNumTemplateArguments
-clang_Type_getTemplateArgumentAsType
-clang_Type_getCXXRefQualifier
-clang_Type_visitFields
-clang_Type_getNamedType
-clang_Type_isTransparentTagTypedef
-clang_Type_getObjCObjectBaseType
-clang_Type_getNumObjCProtocolRefs
-clang_Type_getObjCProtocolDecl
-clang_Type_getNumObjCTypeArgs
-clang_Type_getObjCTypeArg
-clang_Type_getModifiedType
-clang_Type_getNullability
-clang_Type_getValueType
-clang_VerbatimBlockLineComment_getText
-clang_VerbatimLineComment_getText
-clang_HTMLTagComment_getAsString
-clang_FullComment_getAsHTML
-clang_FullComment_getAsXML
-clang_annotateTokens
-clang_codeCompleteAt
-clang_codeCompleteGetContainerKind
-clang_codeCompleteGetContainerUSR
-clang_codeCompleteGetContexts
-clang_codeCompleteGetDiagnostic
-clang_codeCompleteGetNumDiagnostics
-clang_codeCompleteGetObjCSelector
-clang_constructUSR_ObjCCategory
-clang_constructUSR_ObjCClass
-clang_constructUSR_ObjCIvar
-clang_constructUSR_ObjCMethod
-clang_constructUSR_ObjCProperty
-clang_constructUSR_ObjCProtocol
-clang_createCXCursorSet
-clang_createIndex
-clang_createTranslationUnit
-clang_createTranslationUnit2
-clang_createTranslationUnitFromSourceFile
-clang_defaultCodeCompleteOptions
-clang_defaultDiagnosticDisplayOptions
-clang_defaultEditingTranslationUnitOptions
-clang_defaultReparseOptions
-clang_defaultSaveOptions
-clang_disposeCXCursorSet
-clang_disposeCXTUResourceUsage
-clang_disposeCodeCompleteResults
-clang_disposeDiagnostic
-clang_disposeDiagnosticSet
-clang_disposeIndex
-clang_disposeOverriddenCursors
-clang_disposeCXPlatformAvailability
-clang_disposeSourceRangeList
-clang_disposeString
-clang_disposeStringSet
-clang_disposeTokens
-clang_disposeTranslationUnit
-clang_enableStackTraces
-clang_equalCursors
-clang_equalLocations
-clang_equalRanges
-clang_equalTypes
-clang_executeOnThread
-clang_findIncludesInFile
-clang_findIncludesInFileWithBlock
-clang_findReferencesInFile
-clang_findReferencesInFileWithBlock
-clang_formatDiagnostic
-clang_free
-clang_getAddressSpace
-clang_getAllSkippedRanges
-clang_getArgType
-clang_getArrayElementType
-clang_getArraySize
-clang_getBuildSessionTimestamp
-clang_getCString
-clang_getCXTUResourceUsage
-clang_getCXXAccessSpecifier
-clang_getCanonicalCursor
-clang_getCanonicalType
-clang_getChildDiagnostics
-clang_getClangVersion
-clang_getCompletionAnnotation
-clang_getCompletionAvailability
-clang_getCompletionBriefComment
-clang_getCompletionChunkCompletionString
-clang_getCompletionChunkKind
-clang_getCompletionChunkText
-clang_getCompletionNumFixIts
-clang_getCompletionFixIt
-clang_getCompletionNumAnnotations
-clang_getCompletionParent
-clang_getCompletionPriority
-clang_getCursor
-clang_getCursorAvailability
-clang_getCursorCompletionString
-clang_getCursorDefinition
-clang_getCursorDisplayName
-clang_getCursorPrintingPolicy
-clang_getCursorPrettyPrinted
-clang_getCursorExtent
-clang_getCursorExceptionSpecificationType
-clang_getCursorKind
-clang_getCursorKindSpelling
-clang_getCursorLanguage
-clang_getCursorLexicalParent
-clang_getCursorLinkage
-clang_getCursorLocation
-clang_getCursorPlatformAvailability
-clang_getCursorReferenceNameRange
-clang_getCursorReferenced
-clang_getCursorResultType
-clang_getCursorSemanticParent
-clang_getCursorSpelling
-clang_getCursorTLSKind
-clang_getCursorType
-clang_getCursorUSR
-clang_getCursorVisibility
-clang_getDeclObjCTypeEncoding
-clang_getDefinitionSpellingAndExtent
-clang_getDiagnostic
-clang_getDiagnosticCategory
-clang_getDiagnosticCategoryName
-clang_getDiagnosticCategoryText
-clang_getDiagnosticFixIt
-clang_getDiagnosticInSet
-clang_getDiagnosticLocation
-clang_getDiagnosticNumFixIts
-clang_getDiagnosticNumRanges
-clang_getDiagnosticOption
-clang_getDiagnosticRange
-clang_getDiagnosticSetFromTU
-clang_getDiagnosticSeverity
-clang_getDiagnosticSpelling
-clang_getElementType
-clang_getEnumConstantDeclUnsignedValue
-clang_getEnumConstantDeclValue
-clang_getEnumDeclIntegerType
-clang_getExceptionSpecificationType
-clang_getFieldDeclBitWidth
-clang_getExpansionLocation
-clang_getFile
-clang_getFileContents
-clang_getFileLocation
-clang_getFileName
-clang_getFileTime
-clang_getFileUniqueID
-clang_getFunctionTypeCallingConv
-clang_getIBOutletCollectionType
-clang_getIncludedFile
-clang_getInclusions
-clang_getInstantiationLocation
-clang_getLocation
-clang_getLocationForOffset
-clang_getModuleForFile
-clang_getNullCursor
-clang_getNullLocation
-clang_getNullRange
-clang_getNumArgTypes
-clang_getNumCompletionChunks
-clang_getNumDiagnostics
-clang_getNumDiagnosticsInSet
-clang_getNumElements
-clang_getNumOverloadedDecls
-clang_getOverloadedDecl
-clang_getOverriddenCursors
-clang_getPointeeType
-clang_getPresumedLocation
-clang_getRange
-clang_getRangeEnd
-clang_getRangeStart
-clang_getRemappings
-clang_getRemappingsFromFileList
-clang_getResultType
-clang_getSkippedRanges
-clang_getSpecializedCursorTemplate
-clang_getSpellingLocation
-clang_getTUResourceUsageName
-clang_getTemplateCursorKind
-clang_getToken
-clang_getTokenExtent
-clang_getTokenKind
-clang_getTokenLocation
-clang_getTokenSpelling
-clang_getTranslationUnitCursor
-clang_getTranslationUnitSpelling
-clang_getTranslationUnitTargetInfo
-clang_getTypeDeclaration
-clang_getTypeKindSpelling
-clang_getTypeSpelling
-clang_getTypedefDeclUnderlyingType
-clang_getTypedefName
-clang_hashCursor
-clang_indexLoc_getCXSourceLocation
-clang_indexLoc_getFileLocation
-clang_indexSourceFile
-clang_indexSourceFileFullArgv
-clang_indexTranslationUnit
-clang_index_getCXXClassDeclInfo
-clang_index_getClientContainer
-clang_index_getClientEntity
-clang_index_getIBOutletCollectionAttrInfo
-clang_index_getObjCCategoryDeclInfo
-clang_index_getObjCContainerDeclInfo
-clang_index_getObjCInterfaceDeclInfo
-clang_index_getObjCPropertyDeclInfo
-clang_index_getObjCProtocolRefListInfo
-clang_index_isEntityObjCContainerKind
-clang_index_setClientContainer
-clang_index_setClientEntity
-clang_isAttribute
-clang_isConstQualifiedType
-clang_isCursorDefinition
-clang_isDeclaration
-clang_isInvalidDeclaration
-clang_isExpression
-clang_isFileMultipleIncludeGuarded
-clang_isFunctionTypeVariadic
-clang_isInvalid
-clang_isPODType
-clang_isPreprocessing
-clang_isReference
-clang_isRestrictQualifiedType
-clang_isStatement
-clang_isTranslationUnit
-clang_isUnexposed
-clang_isVirtualBase
-clang_isVolatileQualifiedType
-clang_loadDiagnostics
-clang_Location_isInSystemHeader
-clang_Location_isFromMainFile
-clang_parseTranslationUnit
-clang_parseTranslationUnit2
-clang_parseTranslationUnit2FullArgv
-clang_remap_dispose
-clang_remap_getFilenames
-clang_remap_getNumFiles
-clang_reparseTranslationUnit
-clang_saveTranslationUnit
-clang_suspendTranslationUnit
-clang_sortCodeCompletionResults
-clang_toggleCrashRecovery
-clang_tokenize
-clang_CompilationDatabase_fromDirectory
-clang_CompilationDatabase_dispose
-clang_CompilationDatabase_getCompileCommands
-clang_CompilationDatabase_getAllCompileCommands
-clang_CompileCommands_dispose
-clang_CompileCommands_getSize
-clang_CompileCommands_getCommand
-clang_CompileCommand_getDirectory
-clang_CompileCommand_getFilename
-clang_CompileCommand_getMappedSourceContent
-clang_CompileCommand_getMappedSourcePath
-clang_CompileCommand_getNumArgs
-clang_CompileCommand_getArg
-clang_visitChildren
-clang_visitChildrenWithBlock
-clang_ModuleMapDescriptor_create
-clang_ModuleMapDescriptor_dispose
-clang_ModuleMapDescriptor_setFrameworkModuleName
-clang_ModuleMapDescriptor_setUmbrellaHeader
-clang_ModuleMapDescriptor_writeToBuffer
-clang_VirtualFileOverlay_addFileMapping
-clang_VirtualFileOverlay_create
-clang_VirtualFileOverlay_dispose
-clang_VirtualFileOverlay_setCaseSensitivity
-clang_VirtualFileOverlay_writeToBuffer
-clang_Type_getObjCEncoding
-clang_Cursor_isMacroFunctionLike
-clang_Cursor_isMacroBuiltin
-clang_Cursor_isFunctionInlined
-clang_Cursor_hasAttrs
-clang_Cursor_Evaluate
-clang_EvalResult_getKind
-clang_EvalResult_getAsInt
-clang_EvalResult_getAsLongLong
-clang_EvalResult_getAsUnsigned
-clang_EvalResult_isUnsignedInt
-clang_EvalResult_getAsDouble
-clang_EvalResult_getAsStr
-clang_EvalResult_dispose
-clang_PrintingPolicy_getProperty
-clang_PrintingPolicy_setProperty
-clang_PrintingPolicy_dispose
-clang_install_aborting_llvm_fatal_error_handler
-clang_uninstall_llvm_fatal_error_handler
-clang_Cursor_getVarDeclInitializer
-clang_Cursor_hasVarDeclGlobalStorage
-clang_Cursor_hasVarDeclExternalStorage
-clang_CXRewriter_create
-clang_CXRewriter_insertTextBefore
-clang_CXRewriter_replaceText
-clang_CXRewriter_removeText
-clang_CXRewriter_overwriteChangedFiles
-clang_CXRewriter_writeMainFileToStdOut
-clang_CXRewriter_dispose

diff  --git a/clang/tools/libclang/libclang.map b/clang/tools/libclang/libclang.map
new file mode 100644
index 0000000000000..b6fbe6f571642
--- /dev/null
+++ b/clang/tools/libclang/libclang.map
@@ -0,0 +1,415 @@
+/* If you add a symbol to this file, make sure to add it with the correct
+ * version.  For example, if the LLVM main branch is LLVM 14.0.0, add new
+ * symbols with the version LLVM_14.
+ * On platforms where versions scripts are not used, this file will be used to
+ * generate a list of exports for libclang.so
+ */
+
+
+LLVM_13 {
+  clang_BlockCommandComment_getArgText;
+  clang_BlockCommandComment_getCommandName;
+  clang_BlockCommandComment_getNumArgs;
+  clang_BlockCommandComment_getParagraph;
+  clang_CXCursorSet_contains;
+  clang_CXCursorSet_insert;
+  clang_CXIndex_getGlobalOptions;
+  clang_CXIndex_setGlobalOptions;
+  clang_CXIndex_setInvocationEmissionPathOption;
+  clang_CXRewriter_create;
+  clang_CXRewriter_dispose;
+  clang_CXRewriter_insertTextBefore;
+  clang_CXRewriter_overwriteChangedFiles;
+  clang_CXRewriter_removeText;
+  clang_CXRewriter_replaceText;
+  clang_CXRewriter_writeMainFileToStdOut;
+  clang_CXXConstructor_isConvertingConstructor;
+  clang_CXXConstructor_isCopyConstructor;
+  clang_CXXConstructor_isDefaultConstructor;
+  clang_CXXConstructor_isMoveConstructor;
+  clang_CXXField_isMutable;
+  clang_CXXMethod_isConst;
+  clang_CXXMethod_isDefaulted;
+  clang_CXXMethod_isPureVirtual;
+  clang_CXXMethod_isStatic;
+  clang_CXXMethod_isVirtual;
+  clang_CXXRecord_isAbstract;
+  clang_Comment_getChild;
+  clang_Comment_getKind;
+  clang_Comment_getNumChildren;
+  clang_Comment_isWhitespace;
+  clang_CompilationDatabase_dispose;
+  clang_CompilationDatabase_fromDirectory;
+  clang_CompilationDatabase_getAllCompileCommands;
+  clang_CompilationDatabase_getCompileCommands;
+  clang_CompileCommand_getArg;
+  clang_CompileCommand_getDirectory;
+  clang_CompileCommand_getFilename;
+  clang_CompileCommand_getMappedSourceContent;
+  clang_CompileCommand_getMappedSourcePath;
+  clang_CompileCommand_getNumArgs;
+  clang_CompileCommands_dispose;
+  clang_CompileCommands_getCommand;
+  clang_CompileCommands_getSize;
+  clang_Cursor_Evaluate;
+  clang_Cursor_getArgument;
+  clang_Cursor_getBriefCommentText;
+  clang_Cursor_getCXXManglings;
+  clang_Cursor_getCommentRange;
+  clang_Cursor_getMangling;
+  clang_Cursor_getModule;
+  clang_Cursor_getNumArguments;
+  clang_Cursor_getNumTemplateArguments;
+  clang_Cursor_getObjCDeclQualifiers;
+  clang_Cursor_getObjCManglings;
+  clang_Cursor_getObjCPropertyAttributes;
+  clang_Cursor_getObjCPropertyGetterName;
+  clang_Cursor_getObjCPropertySetterName;
+  clang_Cursor_getObjCSelectorIndex;
+  clang_Cursor_getOffsetOfField;
+  clang_Cursor_getParsedComment;
+  clang_Cursor_getRawCommentText;
+  clang_Cursor_getReceiverType;
+  clang_Cursor_getSpellingNameRange;
+  clang_Cursor_getStorageClass;
+  clang_Cursor_getTemplateArgumentKind;
+  clang_Cursor_getTemplateArgumentType;
+  clang_Cursor_getTemplateArgumentUnsignedValue;
+  clang_Cursor_getTemplateArgumentValue;
+  clang_Cursor_getTranslationUnit;
+  clang_Cursor_getVarDeclInitializer;
+  clang_Cursor_hasAttrs;
+  clang_Cursor_hasVarDeclExternalStorage;
+  clang_Cursor_hasVarDeclGlobalStorage;
+  clang_Cursor_isAnonymous;
+  clang_Cursor_isAnonymousRecordDecl;
+  clang_Cursor_isBitField;
+  clang_Cursor_isDynamicCall;
+  clang_Cursor_isExternalSymbol;
+  clang_Cursor_isFunctionInlined;
+  clang_Cursor_isInlineNamespace;
+  clang_Cursor_isMacroBuiltin;
+  clang_Cursor_isMacroFunctionLike;
+  clang_Cursor_isNull;
+  clang_Cursor_isObjCOptional;
+  clang_Cursor_isVariadic;
+  clang_EnumDecl_isScoped;
+  clang_EvalResult_dispose;
+  clang_EvalResult_getAsDouble;
+  clang_EvalResult_getAsInt;
+  clang_EvalResult_getAsLongLong;
+  clang_EvalResult_getAsStr;
+  clang_EvalResult_getAsUnsigned;
+  clang_EvalResult_getKind;
+  clang_EvalResult_isUnsignedInt;
+  clang_File_isEqual;
+  clang_File_tryGetRealPathName;
+  clang_FullComment_getAsHTML;
+  clang_FullComment_getAsXML;
+  clang_HTMLStartTagComment_isSelfClosing;
+  clang_HTMLStartTag_getAttrName;
+  clang_HTMLStartTag_getAttrValue;
+  clang_HTMLStartTag_getNumAttrs;
+  clang_HTMLTagComment_getAsString;
+  clang_HTMLTagComment_getTagName;
+  clang_IndexAction_create;
+  clang_IndexAction_dispose;
+  clang_InlineCommandComment_getArgText;
+  clang_InlineCommandComment_getCommandName;
+  clang_InlineCommandComment_getNumArgs;
+  clang_InlineCommandComment_getRenderKind;
+  clang_InlineContentComment_hasTrailingNewline;
+  clang_Location_isFromMainFile;
+  clang_Location_isInSystemHeader;
+  clang_ModuleMapDescriptor_create;
+  clang_ModuleMapDescriptor_dispose;
+  clang_ModuleMapDescriptor_setFrameworkModuleName;
+  clang_ModuleMapDescriptor_setUmbrellaHeader;
+  clang_ModuleMapDescriptor_writeToBuffer;
+  clang_Module_getASTFile;
+  clang_Module_getFullName;
+  clang_Module_getName;
+  clang_Module_getNumTopLevelHeaders;
+  clang_Module_getParent;
+  clang_Module_getTopLevelHeader;
+  clang_Module_isSystem;
+  clang_ParamCommandComment_getDirection;
+  clang_ParamCommandComment_getParamIndex;
+  clang_ParamCommandComment_getParamName;
+  clang_ParamCommandComment_isDirectionExplicit;
+  clang_ParamCommandComment_isParamIndexValid;
+  clang_PrintingPolicy_dispose;
+  clang_PrintingPolicy_getProperty;
+  clang_PrintingPolicy_setProperty;
+  clang_Range_isNull;
+  clang_TParamCommandComment_getDepth;
+  clang_TParamCommandComment_getIndex;
+  clang_TParamCommandComment_getParamName;
+  clang_TParamCommandComment_isParamPositionValid;
+  clang_TargetInfo_dispose;
+  clang_TargetInfo_getPointerWidth;
+  clang_TargetInfo_getTriple;
+  clang_TextComment_getText;
+  clang_Type_getAlignOf;
+  clang_Type_getCXXRefQualifier;
+  clang_Type_getClassType;
+  clang_Type_getModifiedType;
+  clang_Type_getNamedType;
+  clang_Type_getNullability;
+  clang_Type_getNumObjCProtocolRefs;
+  clang_Type_getNumObjCTypeArgs;
+  clang_Type_getNumTemplateArguments;
+  clang_Type_getObjCEncoding;
+  clang_Type_getObjCObjectBaseType;
+  clang_Type_getObjCProtocolDecl;
+  clang_Type_getObjCTypeArg;
+  clang_Type_getOffsetOf;
+  clang_Type_getSizeOf;
+  clang_Type_getTemplateArgumentAsType;
+  clang_Type_getValueType;
+  clang_Type_isTransparentTagTypedef;
+  clang_Type_visitFields;
+  clang_VerbatimBlockLineComment_getText;
+  clang_VerbatimLineComment_getText;
+  clang_VirtualFileOverlay_addFileMapping;
+  clang_VirtualFileOverlay_create;
+  clang_VirtualFileOverlay_dispose;
+  clang_VirtualFileOverlay_setCaseSensitivity;
+  clang_VirtualFileOverlay_writeToBuffer;
+  clang_annotateTokens;
+  clang_codeCompleteAt;
+  clang_codeCompleteGetContainerKind;
+  clang_codeCompleteGetContainerUSR;
+  clang_codeCompleteGetContexts;
+  clang_codeCompleteGetDiagnostic;
+  clang_codeCompleteGetNumDiagnostics;
+  clang_codeCompleteGetObjCSelector;
+  clang_constructUSR_ObjCCategory;
+  clang_constructUSR_ObjCClass;
+  clang_constructUSR_ObjCIvar;
+  clang_constructUSR_ObjCMethod;
+  clang_constructUSR_ObjCProperty;
+  clang_constructUSR_ObjCProtocol;
+  clang_createCXCursorSet;
+  clang_createIndex;
+  clang_createTranslationUnit;
+  clang_createTranslationUnit2;
+  clang_createTranslationUnitFromSourceFile;
+  clang_defaultCodeCompleteOptions;
+  clang_defaultDiagnosticDisplayOptions;
+  clang_defaultEditingTranslationUnitOptions;
+  clang_defaultReparseOptions;
+  clang_defaultSaveOptions;
+  clang_disposeCXCursorSet;
+  clang_disposeCXPlatformAvailability;
+  clang_disposeCXTUResourceUsage;
+  clang_disposeCodeCompleteResults;
+  clang_disposeDiagnostic;
+  clang_disposeDiagnosticSet;
+  clang_disposeIndex;
+  clang_disposeOverriddenCursors;
+  clang_disposeSourceRangeList;
+  clang_disposeString;
+  clang_disposeStringSet;
+  clang_disposeTokens;
+  clang_disposeTranslationUnit;
+  clang_enableStackTraces;
+  clang_equalCursors;
+  clang_equalLocations;
+  clang_equalRanges;
+  clang_equalTypes;
+  clang_executeOnThread;
+  clang_findIncludesInFile;
+  clang_findIncludesInFileWithBlock;
+  clang_findReferencesInFile;
+  clang_findReferencesInFileWithBlock;
+  clang_formatDiagnostic;
+  clang_free;
+  clang_getAddressSpace;
+  clang_getAllSkippedRanges;
+  clang_getArgType;
+  clang_getArrayElementType;
+  clang_getArraySize;
+  clang_getBuildSessionTimestamp;
+  clang_getCString;
+  clang_getCXTUResourceUsage;
+  clang_getCXXAccessSpecifier;
+  clang_getCanonicalCursor;
+  clang_getCanonicalType;
+  clang_getChildDiagnostics;
+  clang_getClangVersion;
+  clang_getCompletionAnnotation;
+  clang_getCompletionAvailability;
+  clang_getCompletionBriefComment;
+  clang_getCompletionChunkCompletionString;
+  clang_getCompletionChunkKind;
+  clang_getCompletionChunkText;
+  clang_getCompletionFixIt;
+  clang_getCompletionNumAnnotations;
+  clang_getCompletionNumFixIts;
+  clang_getCompletionParent;
+  clang_getCompletionPriority;
+  clang_getCursor;
+  clang_getCursorAvailability;
+  clang_getCursorCompletionString;
+  clang_getCursorDefinition;
+  clang_getCursorDisplayName;
+  clang_getCursorExceptionSpecificationType;
+  clang_getCursorExtent;
+  clang_getCursorKind;
+  clang_getCursorKindSpelling;
+  clang_getCursorLanguage;
+  clang_getCursorLexicalParent;
+  clang_getCursorLinkage;
+  clang_getCursorLocation;
+  clang_getCursorPlatformAvailability;
+  clang_getCursorPrettyPrinted;
+  clang_getCursorPrintingPolicy;
+  clang_getCursorReferenceNameRange;
+  clang_getCursorReferenced;
+  clang_getCursorResultType;
+  clang_getCursorSemanticParent;
+  clang_getCursorSpelling;
+  clang_getCursorTLSKind;
+  clang_getCursorType;
+  clang_getCursorUSR;
+  clang_getCursorVisibility;
+  clang_getDeclObjCTypeEncoding;
+  clang_getDefinitionSpellingAndExtent;
+  clang_getDiagnostic;
+  clang_getDiagnosticCategory;
+  clang_getDiagnosticCategoryName;
+  clang_getDiagnosticCategoryText;
+  clang_getDiagnosticFixIt;
+  clang_getDiagnosticInSet;
+  clang_getDiagnosticLocation;
+  clang_getDiagnosticNumFixIts;
+  clang_getDiagnosticNumRanges;
+  clang_getDiagnosticOption;
+  clang_getDiagnosticRange;
+  clang_getDiagnosticSetFromTU;
+  clang_getDiagnosticSeverity;
+  clang_getDiagnosticSpelling;
+  clang_getElementType;
+  clang_getEnumConstantDeclUnsignedValue;
+  clang_getEnumConstantDeclValue;
+  clang_getEnumDeclIntegerType;
+  clang_getExceptionSpecificationType;
+  clang_getExpansionLocation;
+  clang_getFieldDeclBitWidth;
+  clang_getFile;
+  clang_getFileContents;
+  clang_getFileLocation;
+  clang_getFileName;
+  clang_getFileTime;
+  clang_getFileUniqueID;
+  clang_getFunctionTypeCallingConv;
+  clang_getIBOutletCollectionType;
+  clang_getIncludedFile;
+  clang_getInclusions;
+  clang_getInstantiationLocation;
+  clang_getLocation;
+  clang_getLocationForOffset;
+  clang_getModuleForFile;
+  clang_getNullCursor;
+  clang_getNullLocation;
+  clang_getNullRange;
+  clang_getNumArgTypes;
+  clang_getNumCompletionChunks;
+  clang_getNumDiagnostics;
+  clang_getNumDiagnosticsInSet;
+  clang_getNumElements;
+  clang_getNumOverloadedDecls;
+  clang_getOverloadedDecl;
+  clang_getOverriddenCursors;
+  clang_getPointeeType;
+  clang_getPresumedLocation;
+  clang_getRange;
+  clang_getRangeEnd;
+  clang_getRangeStart;
+  clang_getRemappings;
+  clang_getRemappingsFromFileList;
+  clang_getResultType;
+  clang_getSkippedRanges;
+  clang_getSpecializedCursorTemplate;
+  clang_getSpellingLocation;
+  clang_getTUResourceUsageName;
+  clang_getTemplateCursorKind;
+  clang_getToken;
+  clang_getTokenExtent;
+  clang_getTokenKind;
+  clang_getTokenLocation;
+  clang_getTokenSpelling;
+  clang_getTranslationUnitCursor;
+  clang_getTranslationUnitSpelling;
+  clang_getTranslationUnitTargetInfo;
+  clang_getTypeDeclaration;
+  clang_getTypeKindSpelling;
+  clang_getTypeSpelling;
+  clang_getTypedefDeclUnderlyingType;
+  clang_getTypedefName;
+  clang_hashCursor;
+  clang_indexLoc_getCXSourceLocation;
+  clang_indexLoc_getFileLocation;
+  clang_indexSourceFile;
+  clang_indexSourceFileFullArgv;
+  clang_indexTranslationUnit;
+  clang_index_getCXXClassDeclInfo;
+  clang_index_getClientContainer;
+  clang_index_getClientEntity;
+  clang_index_getIBOutletCollectionAttrInfo;
+  clang_index_getObjCCategoryDeclInfo;
+  clang_index_getObjCContainerDeclInfo;
+  clang_index_getObjCInterfaceDeclInfo;
+  clang_index_getObjCPropertyDeclInfo;
+  clang_index_getObjCProtocolRefListInfo;
+  clang_index_isEntityObjCContainerKind;
+  clang_index_setClientContainer;
+  clang_index_setClientEntity;
+  clang_install_aborting_llvm_fatal_error_handler;
+  clang_isAttribute;
+  clang_isConstQualifiedType;
+  clang_isCursorDefinition;
+  clang_isDeclaration;
+  clang_isExpression;
+  clang_isFileMultipleIncludeGuarded;
+  clang_isFunctionTypeVariadic;
+  clang_isInvalid;
+  clang_isInvalidDeclaration;
+  clang_isPODType;
+  clang_isPreprocessing;
+  clang_isReference;
+  clang_isRestrictQualifiedType;
+  clang_isStatement;
+  clang_isTranslationUnit;
+  clang_isUnexposed;
+  clang_isVirtualBase;
+  clang_isVolatileQualifiedType;
+  clang_loadDiagnostics;
+  clang_parseTranslationUnit;
+  clang_parseTranslationUnit2;
+  clang_parseTranslationUnit2FullArgv;
+  clang_remap_dispose;
+  clang_remap_getFilenames;
+  clang_remap_getNumFiles;
+  clang_reparseTranslationUnit;
+  clang_saveTranslationUnit;
+  clang_sortCodeCompletionResults;
+  clang_suspendTranslationUnit;
+  clang_toggleCrashRecovery;
+  clang_tokenize;
+  clang_uninstall_llvm_fatal_error_handler;
+  clang_visitChildren;
+  clang_visitChildrenWithBlock;
+};
+
+local {
+  local: *;
+};
+
+/* Example of how to add a new symbol version entry.  If you do add a new symbol
+ * version, please update the example to depend on the version you added.
+ * LLVM_X {
+ *  clang_newsymbol;
+ * };
+ */

diff  --git a/clang/tools/libclang/linker-script-to-export-list.py b/clang/tools/libclang/linker-script-to-export-list.py
new file mode 100644
index 0000000000000..aa035c7ed4e43
--- /dev/null
+++ b/clang/tools/libclang/linker-script-to-export-list.py
@@ -0,0 +1,10 @@
+import re
+import os
+
+input_file = open(sys.argv[1])
+output_file = open(sys.argv[2])
+
+for line in input_file:
+    m = re.search('clang_[^;]+', line)
+    if m:
+        output_file.write(m.group(0))


        


More information about the cfe-commits mailing list