[opengtl-commits] [248] * add a function to return the llvm's pointer type for the type |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/opengtl-commits Archives
]
Revision: 248
Author: cyrille
Date: 2008-06-27 22:32:30 +0200 (Fri, 27 Jun 2008)
Log Message:
-----------
* add a function to return the llvm's pointer type for the type
* add a function to create an arbitrary GTL type around a llvm type
Modified Paths:
--------------
trunk/OpenGTL/OpenGTL/GTLCore/Type_p.cpp
trunk/OpenGTL/OpenGTL/GTLCore/Type_p.h
Modified: trunk/OpenGTL/OpenGTL/GTLCore/Type_p.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/Type_p.cpp 2008-06-27 20:31:32 UTC (rev 247)
+++ trunk/OpenGTL/OpenGTL/GTLCore/Type_p.cpp 2008-06-27 20:32:30 UTC (rev 248)
@@ -119,6 +119,11 @@
}
}
+const llvm::Type * Type::Private::pointerType() const
+{
+ return llvm::PointerType::get( type(), 0);
+}
+
void Type::Private::setType( const llvm::Type* _type)
{
GTL_ASSERT(m_type == 0);
@@ -192,3 +197,10 @@
GTL_ASSERT( m_visitor == 0 );
m_visitor = _visitor;
}
+
+Type* Type::Private::createArbitraryType( const llvm::Type* _type)
+{
+ GTLCore::Type* type = new GTLCore::Type();
+ type->d->setType( _type );
+ return type;
+}
Modified: trunk/OpenGTL/OpenGTL/GTLCore/Type_p.h
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/Type_p.h 2008-06-27 20:31:32 UTC (rev 247)
+++ trunk/OpenGTL/OpenGTL/GTLCore/Type_p.h 2008-06-27 20:32:30 UTC (rev 248)
@@ -76,6 +76,10 @@
Private() : m_type(0), m_visitor(0) {}
Private( Type::DataType _dataType );
const llvm::Type * type() const { return m_type; }
+ /**
+ * @return a pointer version of the type a.k.a. llvm::PointerType::get( type(), 0)
+ */
+ const llvm::Type * pointerType() const;
void addFunctionMember( const StructFunctionMember& );
void addPrivateFunctionMember( const StructFunctionMember& );
int memberToIndex(const GTLCore::String&);
@@ -89,6 +93,13 @@
const Type::StructFunctionMember* privateFunctionMember( const GTLCore::String&) const;
const Visitor* visitor() const;
void setVisitor( const Visitor* );
+ /**
+ * This will create an undefined \ref Type associated with the llvm type given in
+ * parameter.
+ * This is used in some special case, for instance for function pointer in
+ * OpenShiva's wrappers.
+ */
+ static Type* createArbitraryType( const llvm::Type* _type);
private:
void setType( const llvm::Type* _type);
const llvm::Type* m_type;