================ @@ -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); + + // the other struct is different only in that it's an anonymous struct, + // without a name ---------------- bogner wrote:
The StructType docs call an unnamed struct a "literal struct" rather than anonymous: https://llvm.org/doxygen/classllvm_1_1StructType.html#details. I would probably just say something to the effect of "ensure that literal structs in the target extension type print the struct body" to mirror the comment earlier. 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