Index: include/llvm-c/BitReader.h =================================================================== --- include/llvm-c/BitReader.h +++ include/llvm-c/BitReader.h @@ -19,6 +19,7 @@ #ifndef LLVM_C_BITREADER_H #define LLVM_C_BITREADER_H +#include "llvm-c/Definitions.h" #include "llvm-c/Types.h" #ifdef __cplusplus @@ -34,21 +35,24 @@ /* Builds a module from the bitcode in the specified memory buffer, returning a reference to the module via the OutModule parameter. Returns 0 on success. - Optionally returns a human-readable error message via OutMessage. - - This is deprecated. Use LLVMParseBitcode2. */ -LLVMBool LLVMParseBitcode(LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutModule, - char **OutMessage); + Optionally returns a human-readable error message via OutMessage. */ +LLVM_ATTRIBUTE_DEPRECATED( + LLVMBool LLVMParseBitcode(LLVMMemoryBufferRef MemBuf, + LLVMModuleRef *OutModule, + char **OutMessage), + "Use LLVMParseBitcode2"); /* Builds a module from the bitcode in the specified memory buffer, returning a reference to the module via the OutModule parameter. Returns 0 on success. */ LLVMBool LLVMParseBitcode2(LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutModule); -/* This is deprecated. Use LLVMParseBitcodeInContext2. */ -LLVMBool LLVMParseBitcodeInContext(LLVMContextRef ContextRef, - LLVMMemoryBufferRef MemBuf, - LLVMModuleRef *OutModule, char **OutMessage); +LLVM_ATTRIBUTE_DEPRECATED( + LLVMBool LLVMParseBitcodeInContext(LLVMContextRef ContextRef, + LLVMMemoryBufferRef MemBuf, + LLVMModuleRef *OutModule, + char **OutMessage), + "Use LLVMParseBitcodeInContext2"); LLVMBool LLVMParseBitcodeInContext2(LLVMContextRef ContextRef, LLVMMemoryBufferRef MemBuf, @@ -56,11 +60,13 @@ /** Reads a module from the specified path, returning via the OutMP parameter a module provider which performs lazy deserialization. Returns 0 on success. - Optionally returns a human-readable error message via OutMessage. - This is deprecated. Use LLVMGetBitcodeModuleInContext2. */ -LLVMBool LLVMGetBitcodeModuleInContext(LLVMContextRef ContextRef, - LLVMMemoryBufferRef MemBuf, - LLVMModuleRef *OutM, char **OutMessage); + Optionally returns a human-readable error message via OutMessage. */ +LLVM_ATTRIBUTE_DEPRECATED( + LLVMBool LLVMGetBitcodeModuleInContext(LLVMContextRef ContextRef, + LLVMMemoryBufferRef MemBuf, + LLVMModuleRef *OutM, + char **OutMessage), + "Use LLVMGetBitcodeModuleInContext2"); /** Reads a module from the specified path, returning via the OutMP parameter a * module provider which performs lazy deserialization. Returns 0 on success. */ @@ -68,9 +74,11 @@ LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutM); -/* This is deprecated. Use LLVMGetBitcodeModule2. */ -LLVMBool LLVMGetBitcodeModule(LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutM, - char **OutMessage); +LLVM_ATTRIBUTE_DEPRECATED( + LLVMBool LLVMGetBitcodeModule(LLVMMemoryBufferRef MemBuf, + LLVMModuleRef *OutM, + char **OutMessage), + "Use LLVMGetBitcodeModule2"); LLVMBool LLVMGetBitcodeModule2(LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutM); Index: include/llvm-c/BitWriter.h =================================================================== --- include/llvm-c/BitWriter.h +++ include/llvm-c/BitWriter.h @@ -41,9 +41,11 @@ int LLVMWriteBitcodeToFD(LLVMModuleRef M, int FD, int ShouldClose, int Unbuffered); -/** Deprecated for LLVMWriteBitcodeToFD. Writes a module to an open file - descriptor. Returns 0 on success. Closes the Handle. */ -int LLVMWriteBitcodeToFileHandle(LLVMModuleRef M, int Handle); +/** Writes a module to an open file descriptor. Returns 0 on success. + Closes the Handle. */ +LLVM_ATTRIBUTE_DEPRECATED( + int LLVMWriteBitcodeToFileHandle(LLVMModuleRef M, int Handle), + "Use LLVMWriteBitcodeToFD"); /** Writes a module to a new memory buffer and returns it. */ LLVMMemoryBufferRef LLVMWriteBitcodeToMemoryBuffer(LLVMModuleRef M); Index: include/llvm-c/Core.h =================================================================== --- include/llvm-c/Core.h +++ include/llvm-c/Core.h @@ -15,6 +15,7 @@ #ifndef LLVM_C_CORE_H #define LLVM_C_CORE_H +#include "llvm-c/Definitions.h" #include "llvm-c/ErrorHandling.h" #include "llvm-c/Types.h" @@ -546,13 +547,21 @@ * Obtain the data layout for a module. * * @see Module::getDataLayoutStr() + */ +const char *LLVMGetDataLayoutStr(LLVMModuleRef M); + +/** + * Obtain the data layout for a module. + * + * @see Module::getDataLayoutStr() * * LLVMGetDataLayout is DEPRECATED, as the name is not only incorrect, * but match the name of another method on the module. Prefer the use * of LLVMGetDataLayoutStr, which is not ambiguous. */ -const char *LLVMGetDataLayoutStr(LLVMModuleRef M); -const char *LLVMGetDataLayout(LLVMModuleRef M); +LLVM_ATTRIBUTE_DEPRECATED( + const char *LLVMGetDataLayout(LLVMModuleRef M), + "Use LLVMGetDataLayoutStr"); /** * Set the data layout for a module. @@ -3110,8 +3119,9 @@ @see llvm::FunctionPassManager::FunctionPassManager */ LLVMPassManagerRef LLVMCreateFunctionPassManagerForModule(LLVMModuleRef M); -/** Deprecated: Use LLVMCreateFunctionPassManagerForModule instead. */ -LLVMPassManagerRef LLVMCreateFunctionPassManager(LLVMModuleProviderRef MP); +LLVM_ATTRIBUTE_DEPRECATED( + LLVMPassManagerRef LLVMCreateFunctionPassManager(LLVMModuleProviderRef MP), + "Use LLVMCreateFunctionPassManagerForModule"); /** Initializes, executes on the provided module, and finalizes all of the passes scheduled in the pass manager. Returns 1 if any of the passes @@ -3152,14 +3162,16 @@ * @{ */ -/** Deprecated: Multi-threading can only be enabled/disabled with the compile - time define LLVM_ENABLE_THREADS. This function always returns - LLVMIsMultithreaded(). */ -LLVMBool LLVMStartMultithreaded(void); +LLVM_ATTRIBUTE_DEPRECATED( + LLVMBool LLVMStartMultithreaded(void), + "Multi-threading can only be enabled/disabled with the compile " + "time define LLVM_ENABLE_THREADS. This function always returns " + "LLVMIsMultithreaded()"); -/** Deprecated: Multi-threading can only be enabled/disabled with the compile - time define LLVM_ENABLE_THREADS. */ -void LLVMStopMultithreaded(void); +LLVM_ATTRIBUTE_DEPRECATED( + void LLVMStopMultithreaded(void), + "Multi-threading can only be enabled/disabled with the compile " + "time define LLVM_ENABLE_THREADS"); /** Check whether LLVM is executing in thread-safe mode or not. @see llvm::llvm_is_multithreaded */ Index: include/llvm-c/Definitions.h =================================================================== --- /dev/null +++ include/llvm-c/Definitions.h @@ -0,0 +1,27 @@ +//===-- llvm-c/Definitions.h - C API Macros --*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file is intended to hold macros used all over the C API. +// +//===----------------------------------------------------------------------===// + +// LLVM_ATTRIBUTE_DEPRECATED(decl, "message") +#if __has_feature(attribute_deprecated_with_message) +# define LLVM_ATTRIBUTE_DEPRECATED(decl, message) \ + decl __attribute__((deprecated(message))) +#elif defined(__GNUC__) +# define LLVM_ATTRIBUTE_DEPRECATED(decl, message) \ + decl __attribute__((deprecated)) +#elif defined(_MSC_VER) +# define LLVM_ATTRIBUTE_DEPRECATED(decl, message) \ + __declspec(deprecated(message)) decl +#else +# define LLVM_ATTRIBUTE_DEPRECATED(decl, message) \ + decl +#endif