[llvm-commits] [llvm] r149000 - in /llvm/trunk: include/llvm/Type.h lib/VMCore/Type.cpp
Chris Lattner
sabre at nondot.org
Wed Jan 25 16:06:44 PST 2012
Author: lattner
Date: Wed Jan 25 18:06:44 2012
New Revision: 149000
URL: http://llvm.org/viewvc/llvm-project?rev=149000&view=rev
Log:
add StructType helpers too.
Modified:
llvm/trunk/include/llvm/Type.h
llvm/trunk/lib/VMCore/Type.cpp
Modified: llvm/trunk/include/llvm/Type.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Type.h?rev=149000&r1=148999&r2=149000&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Type.h (original)
+++ llvm/trunk/include/llvm/Type.h Wed Jan 25 18:06:44 2012
@@ -26,6 +26,7 @@
class Module;
class LLVMContext;
class LLVMContextImpl;
+class StringRef;
template<class GraphType> struct GraphTraits;
/// The instances of the Type class are immutable: once they are created,
@@ -327,7 +328,9 @@
unsigned getFunctionNumParams() const;
bool isFunctionVarArg() const;
- // TODO: StructType
+ StringRef getStructName() const;
+ unsigned getStructNumElements() const;
+ Type *getStructElementType(unsigned N) const;
Type *getSequentialElementType() const;
Modified: llvm/trunk/lib/VMCore/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Type.cpp?rev=149000&r1=148999&r2=149000&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Type.cpp (original)
+++ llvm/trunk/lib/VMCore/Type.cpp Wed Jan 25 18:06:44 2012
@@ -217,6 +217,20 @@
return cast<FunctionType>(this)->getNumParams();
}
+StringRef Type::getStructName() const {
+ return cast<StructType>(this)->getName();
+}
+
+unsigned Type::getStructNumElements() const {
+ return cast<StructType>(this)->getNumElements();
+}
+
+Type *Type::getStructElementType(unsigned N) const {
+ return cast<StructType>(this)->getElementType(N);
+}
+
+
+
Type *Type::getSequentialElementType() const {
return cast<SequentialType>(this)->getElementType();
}
More information about the llvm-commits
mailing list