Skip to content

Commit c0609a6

Browse files
Thomas SymallaFlakebi
authored andcommitted
Fix warning about deprecated PtrType::get method.
This expects to use the `Context` overload directly, so just use it.
1 parent ebc2b5a commit c0609a6

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

example/ExampleMain.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ void createFunctionExample(Module &module, const Twine &name) {
105105

106106
y6->setIndex(b.getInt32(1));
107107

108-
Value *p1 = b.create<xd::cpp::ReadOp>(b.getPtrTy(0));
108+
Value *p1 = b.create<xd::cpp::ReadOp>(b.getPtrTy());
109109
p1->setName("p1");
110110
Value *p2 = b.create<xd::cpp::StreamAddOp>(p1, b.getInt64(14), b.getInt8(0));
111111
p2->setName("p2");

include/llvm-dialects/Dialect/Dialect.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def I64 : TgConstant<(IntegerType 64)>, Type;
175175
def PointerType : BuiltinType {
176176
let arguments = (args type:$self, AttrI32:$address_space);
177177
// Supports both typed and opaque pointers.
178-
let evaluate = "::llvm::PointerType::get(::llvm::Type::getInt8Ty($_context), $address_space)";
178+
let evaluate = "::llvm::PointerType::get($_context, $address_space)";
179179
let check = "$self->isPointerTy()";
180180
let capture = ["$self->getPointerAddressSpace()"];
181181
}

test/example/generated/ExampleDialect.cpp.inc

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -564,17 +564,17 @@ rhs
564564
::llvm::Type * const retType = getRet()->getType();
565565
(void)retType;
566566

567-
if (::llvm::PointerType::get(::llvm::Type::getInt8Ty(context), 0) != lhsType) {
567+
if (::llvm::PointerType::get(context, 0) != lhsType) {
568568
errs << " unexpected value of $lhs:\n";
569-
errs << " expected: " << printable(::llvm::PointerType::get(::llvm::Type::getInt8Ty(context), 0)) << '\n';
569+
errs << " expected: " << printable(::llvm::PointerType::get(context, 0)) << '\n';
570570
errs << " actual: " << printable(lhsType) << '\n';
571571

572572
return false;
573573
}
574574

575-
if (::llvm::PointerType::get(::llvm::Type::getInt8Ty(context), 0) != rhsType) {
575+
if (::llvm::PointerType::get(context, 0) != rhsType) {
576576
errs << " unexpected value of $rhs:\n";
577-
errs << " expected: " << printable(::llvm::PointerType::get(::llvm::Type::getInt8Ty(context), 0)) << '\n';
577+
errs << " expected: " << printable(::llvm::PointerType::get(context, 0)) << '\n';
578578
errs << " actual: " << printable(rhsType) << '\n';
579579

580580
return false;
@@ -2077,9 +2077,9 @@ initial
20772077
::llvm::Type * const resultType = getResult()->getType();
20782078
(void)resultType;
20792079

2080-
if (::llvm::PointerType::get(::llvm::Type::getInt8Ty(context), 0) != ptrType) {
2080+
if (::llvm::PointerType::get(context, 0) != ptrType) {
20812081
errs << " unexpected value of $ptr:\n";
2082-
errs << " expected: " << printable(::llvm::PointerType::get(::llvm::Type::getInt8Ty(context), 0)) << '\n';
2082+
errs << " expected: " << printable(::llvm::PointerType::get(context, 0)) << '\n';
20832083
errs << " actual: " << printable(ptrType) << '\n';
20842084

20852085
return false;
@@ -2169,9 +2169,9 @@ initial
21692169
::llvm::Type * const resultType = getResult()->getType();
21702170
(void)resultType;
21712171

2172-
if (::llvm::PointerType::get(::llvm::Type::getInt8Ty(context), 0) != ptrType) {
2172+
if (::llvm::PointerType::get(context, 0) != ptrType) {
21732173
errs << " unexpected value of $ptr:\n";
2174-
errs << " expected: " << printable(::llvm::PointerType::get(::llvm::Type::getInt8Ty(context), 0)) << '\n';
2174+
errs << " expected: " << printable(::llvm::PointerType::get(context, 0)) << '\n';
21752175
errs << " actual: " << printable(ptrType) << '\n';
21762176

21772177
return false;
@@ -2261,9 +2261,9 @@ initial
22612261
::llvm::Type * const resultType = getResult()->getType();
22622262
(void)resultType;
22632263

2264-
if (::llvm::PointerType::get(::llvm::Type::getInt8Ty(context), 0) != ptrType) {
2264+
if (::llvm::PointerType::get(context, 0) != ptrType) {
22652265
errs << " unexpected value of $ptr:\n";
2266-
errs << " expected: " << printable(::llvm::PointerType::get(::llvm::Type::getInt8Ty(context), 0)) << '\n';
2266+
errs << " expected: " << printable(::llvm::PointerType::get(context, 0)) << '\n';
22672267
errs << " actual: " << printable(ptrType) << '\n';
22682268

22692269
return false;
@@ -2303,7 +2303,7 @@ initial
23032303
const ::llvm::AttributeList attrs
23042304
= ExampleDialect::get(context).getAttributeList(6);
23052305
auto fnType = ::llvm::FunctionType::get(::llvm::Type::getVoidTy(context), {
2306-
::llvm::PointerType::get(::llvm::Type::getInt8Ty(context), 0),
2306+
::llvm::PointerType::get(context, 0),
23072307
}, false);
23082308

23092309
auto fn = module.getOrInsertFunction(s_name, fnType, attrs);
@@ -2343,10 +2343,10 @@ initial
23432343
return false;
23442344
}
23452345

2346-
if (getArgOperand(0)->getType() != ::llvm::PointerType::get(::llvm::Type::getInt8Ty(context), 0)) {
2346+
if (getArgOperand(0)->getType() != ::llvm::PointerType::get(context, 0)) {
23472347
errs << " argument 0 (val) has type: "
23482348
<< *getArgOperand(0)->getType() << '\n';
2349-
errs << " expected: " << *::llvm::PointerType::get(::llvm::Type::getInt8Ty(context), 0) << '\n';
2349+
errs << " expected: " << *::llvm::PointerType::get(context, 0) << '\n';
23502350
return false;
23512351
}
23522352
::llvm::StringRef const val = getVal();

0 commit comments

Comments
 (0)