[pygobject/llvm: 6/12] add a name for PyObject/GObject structs



commit 83793a26d1461b3717410abe981612d4e4a90617
Author: Johan Dahlin <johan gnome org>
Date:   Mon Jul 5 20:32:57 2010 -0300

    add a name for PyObject/GObject structs

 gi/llvm-compiler.cpp |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/gi/llvm-compiler.cpp b/gi/llvm-compiler.cpp
index 6e4ec85..277ca4d 100644
--- a/gi/llvm-compiler.cpp
+++ b/gi/llvm-compiler.cpp
@@ -90,7 +90,6 @@ PyObject* _PyGObject_New(GObject *o) {
 using namespace pygi;
 
 static llvm::IRBuilder<> Builder(llvm::getGlobalContext());
-// PyObject = { ssize_t ob_refcnt, struct* ob_type }
 // PyTupleObject = { ssize_t ob_refcnt, struct* ob_type, ssize_t ob_size, PyObject* }
 static llvm::Type* pyObjectPtr = NULL;
 static llvm::Type* gObjectPtr = NULL;
@@ -482,9 +481,16 @@ LLVMCompiler::createPyNone()
 void
 LLVMCompiler::loadSymbols()
 {
-  // llvm
-  pyObjectPtr = llvm::PointerType::getUnqual(llvm::StructType::get(mCtx, NULL, NULL));
-  gObjectPtr = llvm::PointerType::getUnqual(llvm::StructType::get(mCtx, NULL, NULL));
+  // PyObject = { ssize_t ob_refcnt, struct* ob_type }
+  llvm::StructType *pyObject = llvm::StructType::get(mCtx,
+                                                     llvm::TypeBuilder<ssize_t, false>::get(mCtx),
+                                                     llvm::TypeBuilder<void*, false>::get(mCtx), NULL);
+  mModule->addTypeName("PyObject", pyObject);
+  pyObjectPtr = llvm::PointerType::getUnqual(pyObject);
+
+  llvm::StructType *gObject = llvm::StructType::get(mCtx, NULL, NULL);
+  mModule->addTypeName("GObject", gObject);
+  gObjectPtr = llvm::PointerType::getUnqual(gObject);
 
   _PyLong_CheckFunc =
     llvm::cast<llvm::Function>(mModule->getOrInsertFunction("_PyLong_Check",



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]