1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

Make it possible to get an empty struct using

the new StructType::get method.  The second NULL
is to pacify the gcc warning mechanism.  This
patch compiles but is otherwise untested.

llvm-svn: 48645
This commit is contained in:
Duncan Sands 2008-03-21 15:53:17 +00:00
parent 4153fc30c9
commit a53967843f
2 changed files with 6 additions and 4 deletions

View File

@ -221,8 +221,9 @@ public:
bool isPacked=false);
/// StructType::get - This static method is a convenience method for
/// creating structure types by specifying the elements as arguments. Note
/// that this method always returns a non-packed struct.
/// creating structure types by specifying the elements as arguments.
/// Note that this method always returns a non-packed struct. To get
/// an empty struct, pass NULL, NULL.
static StructType *get(const Type *type, ...) END_WITH_NULL;
// Iterator access to the elements

View File

@ -1252,9 +1252,10 @@ StructType *StructType::get(const Type *type, ...) {
va_list ap;
std::vector<const llvm::Type*> StructFields;
va_start(ap, type);
do {
while (type) {
StructFields.push_back(type);
} while ((type = va_arg(ap, llvm::Type*)));
type = va_arg(ap, llvm::Type*);
}
return llvm::StructType::get(StructFields);
}