[PATCH] D109192: [WIP/DNM] Support: introduce public API annotation support

Tom Stellard via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 8 16:37:59 PDT 2023


tstellar updated this revision to Diff 529776.
tstellar added a comment.
Herald added subscribers: bzcheeseman, wenlei.

After talking with @compnerd on Discord, I'm planning on helping to push this
patch through.  At this point my goal is just to annotate the ABI functions and
not make any changes to how -DBUILD_SHARED_LIBS=ON or -DLLVM_LINK_LLVM_DYLIB=ON
behave.  We can make changes to those configurations in a future patch (if we
want to).

My plan is to:

1. Annotate all the ABI functions in the LLVM support library with LLVM_SUPPORT_ABI

macro (this patch), and use this an example for how to do the rest of the annotations.

2. Annotate the rest of the LLVM ABI functions using a different macro (e.g. LLVM_ABI)
3. Annotate the C ABI with a third macro (e.g. LLVM_C_ABI).
4. Annotate the clang C++ ABI with another macro (e.g. CLANG_CPP_ABI).
5. Do an analysis of which ABI functions usage inside and outside of the tree, and

remove unused functions from the public ABI (i.e. mark them as visibility hidden).

For this patch, I've rebased it on main and made a few changes:

- Add ABI annotations to classes and remove them from class member functions.

This will make the patch smaller and easier to maintain.  We can always revisit
this in the future once we have the complete set of ABIs annotated.

- Use default visibility instead of protected visibility on Linux.

- Drop the `add_llvm_component_library(LLVMSupport SHARED` change.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109192/new/

https://reviews.llvm.org/D109192

Files:
  llvm/include/llvm-c/Core.h
  llvm/include/llvm-c/Error.h
  llvm/include/llvm-c/ErrorHandling.h
  llvm/include/llvm-c/Support.h
  llvm/include/llvm/ADT/APFixedPoint.h
  llvm/include/llvm/ADT/APFloat.h
  llvm/include/llvm/ADT/APInt.h
  llvm/include/llvm/ADT/APSInt.h
  llvm/include/llvm/ADT/AllocatorList.h
  llvm/include/llvm/ADT/ArrayRef.h
  llvm/include/llvm/ADT/BitVector.h
  llvm/include/llvm/ADT/BitmaskEnum.h
  llvm/include/llvm/ADT/DAGDeltaAlgorithm.h
  llvm/include/llvm/ADT/DeltaAlgorithm.h
  llvm/include/llvm/ADT/DenseMap.h
  llvm/include/llvm/ADT/DenseMapInfo.h
  llvm/include/llvm/ADT/DenseSet.h
  llvm/include/llvm/ADT/EpochTracker.h
  llvm/include/llvm/ADT/FloatingPointMode.h
  llvm/include/llvm/ADT/FoldingSet.h
  llvm/include/llvm/ADT/GraphTraits.h
  llvm/include/llvm/ADT/Hashing.h
  llvm/include/llvm/ADT/IntEqClasses.h
  llvm/include/llvm/ADT/IntervalMap.h
  llvm/include/llvm/ADT/IntrusiveRefCntPtr.h
  llvm/include/llvm/ADT/PointerIntPair.h
  llvm/include/llvm/ADT/STLExtras.h
  llvm/include/llvm/ADT/STLForwardCompat.h
  llvm/include/llvm/ADT/STLFunctionalExtras.h
  llvm/include/llvm/ADT/ScopeExit.h
  llvm/include/llvm/ADT/SetVector.h
  llvm/include/llvm/ADT/SmallPtrSet.h
  llvm/include/llvm/ADT/SmallString.h
  llvm/include/llvm/ADT/SmallVector.h
  llvm/include/llvm/ADT/Statistic.h
  llvm/include/llvm/ADT/StringExtras.h
  llvm/include/llvm/ADT/StringMap.h
  llvm/include/llvm/ADT/StringMapEntry.h
  llvm/include/llvm/ADT/StringRef.h
  llvm/include/llvm/ADT/StringSet.h
  llvm/include/llvm/ADT/StringSwitch.h
  llvm/include/llvm/ADT/Twine.h
  llvm/include/llvm/ADT/UniqueVector.h
  llvm/include/llvm/ADT/bit.h
  llvm/include/llvm/ADT/identity.h
  llvm/include/llvm/ADT/ilist.h
  llvm/include/llvm/ADT/ilist_base.h
  llvm/include/llvm/ADT/ilist_iterator.h
  llvm/include/llvm/ADT/ilist_node.h
  llvm/include/llvm/ADT/ilist_node_base.h
  llvm/include/llvm/ADT/ilist_node_options.h
  llvm/include/llvm/ADT/iterator.h
  llvm/include/llvm/ADT/iterator_range.h
  llvm/include/llvm/ADT/simple_ilist.h
  llvm/include/llvm/Config/abi-breaking.h.cmake
  llvm/include/llvm/Demangle/Demangle.h
  llvm/include/llvm/Support/AMDGPUMetadata.h
  llvm/include/llvm/Support/AMDHSAKernelDescriptor.h
  llvm/include/llvm/Support/ARMAttributeParser.h
  llvm/include/llvm/Support/ARMBuildAttributes.h
  llvm/include/llvm/Support/ARMWinEH.h
  llvm/include/llvm/Support/AlignOf.h
  llvm/include/llvm/Support/Alignment.h
  llvm/include/llvm/Support/Allocator.h
  llvm/include/llvm/Support/AllocatorBase.h
  llvm/include/llvm/Support/ArrayRecycler.h
  llvm/include/llvm/Support/Atomic.h
  llvm/include/llvm/Support/AtomicOrdering.h
  llvm/include/llvm/Support/Automaton.h
  llvm/include/llvm/Support/BalancedPartitioning.h
  llvm/include/llvm/Support/Base64.h
  llvm/include/llvm/Support/BinaryByteStream.h
  llvm/include/llvm/Support/BinaryStream.h
  llvm/include/llvm/Support/BinaryStreamArray.h
  llvm/include/llvm/Support/BinaryStreamError.h
  llvm/include/llvm/Support/BinaryStreamReader.h
  llvm/include/llvm/Support/BinaryStreamRef.h
  llvm/include/llvm/Support/BinaryStreamWriter.h
  llvm/include/llvm/Support/BlockFrequency.h
  llvm/include/llvm/Support/BranchProbability.h
  llvm/include/llvm/Support/BuryPointer.h
  llvm/include/llvm/Support/COM.h
  llvm/include/llvm/Support/CRC.h
  llvm/include/llvm/Support/CSKYAttributeParser.h
  llvm/include/llvm/Support/CSKYAttributes.h
  llvm/include/llvm/Support/CachePruning.h
  llvm/include/llvm/Support/Caching.h
  llvm/include/llvm/Support/Casting.h
  llvm/include/llvm/Support/Chrono.h
  llvm/include/llvm/Support/CodeGenCoverage.h
  llvm/include/llvm/Support/CommandLine.h
  llvm/include/llvm/Support/Compression.h
  llvm/include/llvm/Support/ConvertEBCDIC.h
  llvm/include/llvm/Support/ConvertUTF.h
  llvm/include/llvm/Support/CrashRecoveryContext.h
  llvm/include/llvm/Support/DJB.h
  llvm/include/llvm/Support/DOTGraphTraits.h
  llvm/include/llvm/Support/DataExtractor.h
  llvm/include/llvm/Support/Debug.h
  llvm/include/llvm/Support/DebugCounter.h
  llvm/include/llvm/Support/DivisionByConstantInfo.h
  llvm/include/llvm/Support/Duration.h
  llvm/include/llvm/Support/DynamicLibrary.h
  llvm/include/llvm/Support/ELFAttributeParser.h
  llvm/include/llvm/Support/ELFAttributes.h
  llvm/include/llvm/Support/Endian.h
  llvm/include/llvm/Support/Errc.h
  llvm/include/llvm/Support/Errno.h
  llvm/include/llvm/Support/Error.h
  llvm/include/llvm/Support/ErrorHandling.h
  llvm/include/llvm/Support/ErrorOr.h
  llvm/include/llvm/Support/ExtensibleRTTI.h
  llvm/include/llvm/Support/FileCollector.h
  llvm/include/llvm/Support/FileOutputBuffer.h
  llvm/include/llvm/Support/FileSystem.h
  llvm/include/llvm/Support/FileSystem/UniqueID.h
  llvm/include/llvm/Support/FileUtilities.h
  llvm/include/llvm/Support/Format.h
  llvm/include/llvm/Support/FormatCommon.h
  llvm/include/llvm/Support/FormatProviders.h
  llvm/include/llvm/Support/FormatVariadic.h
  llvm/include/llvm/Support/FormatVariadicDetails.h
  llvm/include/llvm/Support/FormattedStream.h
  llvm/include/llvm/Support/GlobPattern.h
  llvm/include/llvm/Support/GraphWriter.h
  llvm/include/llvm/Support/InitLLVM.h
  llvm/include/llvm/Support/InstructionCost.h
  llvm/include/llvm/Support/JSON.h
  llvm/include/llvm/Support/KnownBits.h
  llvm/include/llvm/Support/LEB128.h
  llvm/include/llvm/Support/LLVMSupportExports.h
  llvm/include/llvm/Support/LineIterator.h
  llvm/include/llvm/Support/Locale.h
  llvm/include/llvm/Support/LockFileManager.h
  llvm/include/llvm/Support/MD5.h
  llvm/include/llvm/Support/MSP430AttributeParser.h
  llvm/include/llvm/Support/MSP430Attributes.h
  llvm/include/llvm/Support/ManagedStatic.h
  llvm/include/llvm/Support/MemAlloc.h
  llvm/include/llvm/Support/Memory.h
  llvm/include/llvm/Support/MemoryBuffer.h
  llvm/include/llvm/Support/MemoryBufferRef.h
  llvm/include/llvm/Support/Mutex.h
  llvm/include/llvm/Support/NativeFormatting.h
  llvm/include/llvm/Support/OptimizedStructLayout.h
  llvm/include/llvm/Support/PGOOptions.h
  llvm/include/llvm/Support/Parallel.h
  llvm/include/llvm/Support/Path.h
  llvm/include/llvm/Support/PluginLoader.h
  llvm/include/llvm/Support/PointerLikeTypeTraits.h
  llvm/include/llvm/Support/PrettyStackTrace.h
  llvm/include/llvm/Support/Process.h
  llvm/include/llvm/Support/Program.h
  llvm/include/llvm/Support/RISCVAttributeParser.h
  llvm/include/llvm/Support/RISCVAttributes.h
  llvm/include/llvm/Support/RISCVISAInfo.h
  llvm/include/llvm/Support/RWMutex.h
  llvm/include/llvm/Support/RandomNumberGenerator.h
  llvm/include/llvm/Support/Recycler.h
  llvm/include/llvm/Support/RecyclingAllocator.h
  llvm/include/llvm/Support/Regex.h
  llvm/include/llvm/Support/SHA1.h
  llvm/include/llvm/Support/SHA256.h
  llvm/include/llvm/Support/SMLoc.h
  llvm/include/llvm/Support/SMTAPI.h
  llvm/include/llvm/Support/SaveAndRestore.h
  llvm/include/llvm/Support/ScaledNumber.h
  llvm/include/llvm/Support/ScopedPrinter.h
  llvm/include/llvm/Support/Signals.h
  llvm/include/llvm/Support/Signposts.h
  llvm/include/llvm/Support/SmallVectorMemoryBuffer.h
  llvm/include/llvm/Support/SourceMgr.h
  llvm/include/llvm/Support/SpecialCaseList.h
  llvm/include/llvm/Support/StringSaver.h
  llvm/include/llvm/Support/SuffixTree.h
  llvm/include/llvm/Support/SuffixTreeNode.h
  llvm/include/llvm/Support/SystemUtils.h
  llvm/include/llvm/Support/TarWriter.h
  llvm/include/llvm/Support/ThreadPool.h
  llvm/include/llvm/Support/Threading.h
  llvm/include/llvm/Support/TimeProfiler.h
  llvm/include/llvm/Support/Timer.h
  llvm/include/llvm/Support/ToolOutputFile.h
  llvm/include/llvm/Support/TrigramIndex.h
  llvm/include/llvm/Support/TypeSize.h
  llvm/include/llvm/Support/Unicode.h
  llvm/include/llvm/Support/UnicodeCharRanges.h
  llvm/include/llvm/Support/Valgrind.h
  llvm/include/llvm/Support/VersionTuple.h
  llvm/include/llvm/Support/VirtualFileSystem.h
  llvm/include/llvm/Support/Watchdog.h
  llvm/include/llvm/Support/WindowsError.h
  llvm/include/llvm/Support/WithColor.h
  llvm/include/llvm/Support/YAMLParser.h
  llvm/include/llvm/Support/YAMLTraits.h
  llvm/include/llvm/Support/circular_raw_ostream.h
  llvm/include/llvm/Support/raw_os_ostream.h
  llvm/include/llvm/Support/raw_ostream.h
  llvm/include/llvm/Support/thread.h
  llvm/include/llvm/Support/type_traits.h
  llvm/include/llvm/Support/xxhash.h
  llvm/lib/Support/CMakeLists.txt
  llvm/lib/Support/Unix/Threading.inc
  llvm/lib/Support/Windows/Threading.inc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109192.529776.patch
Type: text/x-patch
Size: 479522 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230608/d96472f8/attachment-0001.bin>


More information about the llvm-commits mailing list