From 1372b786798f5be7497644bcfc3d8ecdd685e6d9 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Wed, 5 Mar 2014 02:34:23 +0000 Subject: [PATCH] C API: Add functions to get or set a GlobalValue's DLLStorageClass Patch by Manuel Jacob! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202928 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm-c/Core.h | 8 ++++++++ lib/IR/Core.cpp | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/include/llvm-c/Core.h b/include/llvm-c/Core.h index a84a0313211..af1e01d8e1b 100644 --- a/include/llvm-c/Core.h +++ b/include/llvm-c/Core.h @@ -299,6 +299,12 @@ typedef enum { LLVMProtectedVisibility /**< The GV is protected */ } LLVMVisibility; +typedef enum { + LLVMDefaultStorageClass = 0, + LLVMDLLImportStorageClass = 1, /**< Function to be imported from DLL. */ + LLVMDLLExportStorageClass = 2 /**< Function to be accessible from DLL. */ +} LLVMDLLStorageClass; + typedef enum { LLVMCCallConv = 0, LLVMFastCallConv = 8, @@ -1689,6 +1695,8 @@ const char *LLVMGetSection(LLVMValueRef Global); void LLVMSetSection(LLVMValueRef Global, const char *Section); LLVMVisibility LLVMGetVisibility(LLVMValueRef Global); void LLVMSetVisibility(LLVMValueRef Global, LLVMVisibility Viz); +LLVMDLLStorageClass LLVMGetDLLStorageClass(LLVMValueRef Global); +void LLVMSetDLLStorageClass(LLVMValueRef Global, LLVMDLLStorageClass Class); /** * @defgroup LLVMCCoreValueWithAlignment Values with alignment diff --git a/lib/IR/Core.cpp b/lib/IR/Core.cpp index 470fef23eb8..c78ddae60be 100644 --- a/lib/IR/Core.cpp +++ b/lib/IR/Core.cpp @@ -1252,6 +1252,16 @@ void LLVMSetVisibility(LLVMValueRef Global, LLVMVisibility Viz) { ->setVisibility(static_cast(Viz)); } +LLVMDLLStorageClass LLVMGetDLLStorageClass(LLVMValueRef Global) { + return static_cast( + unwrap(Global)->getDLLStorageClass()); +} + +void LLVMSetDLLStorageClass(LLVMValueRef Global, LLVMDLLStorageClass Class) { + unwrap(Global)->setDLLStorageClass( + static_cast(Class)); +} + /*--.. Operations on global variables, load and store instructions .........--*/ unsigned LLVMGetAlignment(LLVMValueRef V) {