[PATCH] D52659: [LLVM-C] Add an accessor for the "value type" of a global
Robert Widmann via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 28 13:56:12 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL343363: [LLVM-C] Add an accessor for the "value type" of a global (authored by CodaFi, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D52659?vs=167500&id=167543#toc
Repository:
rL LLVM
https://reviews.llvm.org/D52659
Files:
llvm/trunk/include/llvm-c/Core.h
llvm/trunk/lib/IR/Core.cpp
Index: llvm/trunk/include/llvm-c/Core.h
===================================================================
--- llvm/trunk/include/llvm-c/Core.h
+++ llvm/trunk/include/llvm-c/Core.h
@@ -2104,6 +2104,14 @@
LLVMUnnamedAddr LLVMGetUnnamedAddress(LLVMValueRef Global);
void LLVMSetUnnamedAddress(LLVMValueRef Global, LLVMUnnamedAddr UnnamedAddr);
+/**
+ * Returns the "value type" of a global value. This differs from the formal
+ * type of a global value which is always a pointer type.
+ *
+ * @see llvm::GlobalValue::getValueType()
+ */
+LLVMTypeRef LLVMGlobalGetValueType(LLVMValueRef Global);
+
/** Deprecated: Use LLVMGetUnnamedAddress instead. */
LLVMBool LLVMHasUnnamedAddr(LLVMValueRef Global);
/** Deprecated: Use LLVMSetUnnamedAddress instead. */
Index: llvm/trunk/lib/IR/Core.cpp
===================================================================
--- llvm/trunk/lib/IR/Core.cpp
+++ llvm/trunk/lib/IR/Core.cpp
@@ -1876,6 +1876,10 @@
: GlobalValue::UnnamedAddr::None);
}
+LLVMTypeRef LLVMGlobalGetValueType(LLVMValueRef Global) {
+ return wrap(unwrap<GlobalValue>(Global)->getValueType());
+}
+
/*--.. Operations on global variables, load and store instructions .........--*/
unsigned LLVMGetAlignment(LLVMValueRef V) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52659.167543.patch
Type: text/x-patch
Size: 1265 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180928/d57a311d/attachment.bin>
More information about the llvm-commits
mailing list