================
@@ -40,10 +40,43 @@ TEST(TypesTest, TargetExtType) {
   Type *A = TargetExtType::get(Context, "typea");
   Type *Aparam = TargetExtType::get(Context, "typea", {}, {0, 1});
   Type *Aparam2 = TargetExtType::get(Context, "typea", {}, {0, 1});
+
   // Opaque types with same parameters are identical...
   EXPECT_EQ(Aparam, Aparam2);
   // ... but just having the same name is not enough.
   EXPECT_NE(A, Aparam);
+
+  // ensure struct types in targest extension types
+  // only show the struct name, not the struct body
+  Type *Int32Type = Type::getInt32Ty(Context);
+  Type *FloatType = Type::getFloatTy(Context);
+  std::vector<Type *> OriginalElements = {Int32Type, FloatType};
+  StructType *Struct = llvm::StructType::create(Context, "MyStruct");
+  Struct->setBody(OriginalElements);
----------------
bogner wrote:

There's an overload of `create` that sets the elements directly:
```suggestion
  StructType *Struct = llvm::StructType::create(Context, Elements, "MyStruct",
                                                /*isPacked=*/false);
```

https://github.com/llvm/llvm-project/pull/115971
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to