OpaqueType:: get()

I have code that uses OpaqueType::get(), it was used to be in llvm/IR/DerivedType.h , but it is removed now. What should I use for it replacement.

Also, it is using #include <llvm/Bytecode/WriteBytecodePass.h> , but I do not found any WriteBytecodePass.h in my source code. Please tell me, what should I use in replacement of these.

Thanks& Regards,
Ratnesh Tiwari

I have code that uses OpaqueType::get(), it was used to be in llvm/IR/DerivedType.h , but it is removed now. What should I use for it replacement.

Oh, that must be some pretty old code! I think OpaqueType was removed
in the type system rewrite around LLVM 3.0. Chris wrote a blog about
the changes at the time:
LLVM 3.0 Type System Rewrite - The LLVM Project Blog.

The replacement for an opaque type is a StructType that hasn't had its
body filled in yet. I.e. what you get back from StructType::create.

Also, it is using #include <llvm/Bytecode/WriteBytecodePass.h> , but I do not found any WriteBytecodePass.h in my source code. Please tell me, what should I use in replacement of these.

Bytecode went away even earlier in LLVM's history. The replacement is
called bitcode. The header you'll need is
llvm/Bitcode/BitcodeWriter.h, and it's not a pass any more. Possibly
the simplest example of its use would be tools/llvm-as/llvm-as.cpp.

Cheers.

Tim.

Also, it is using #include <llvm/Bytecode/WriteBytecodePass.h> , but I do not found any WriteBytecodePass.h in my source code. Please tell me, what should I use in replacement of these.

Bytecode went away even earlier in LLVM's history. The replacement is
called bitcode.

I believe this change was introduced in LLVM 2.0 that was released ...
more than 11 years ago :wink:

Thanks, for suggesting me of the replacement of OpaqueType, but I am little confused how to use StructType, I mean I am following the code of this project :https://llvm.org/svn/llvm-project/java/trunk/lib/Compiler/Resolver.cpp
Here it is used OpaqueType::get() , So according to you I have to first create StrructType like “StructType::create(LLVMContext & Context)” and then use StructType::get() ? Please suggest me how to use of StructType in here? Thanks in advance.

Nope, just use StructType::create. get is used when you already know
the members and want an unnamed struct by the looks of it, which
doesn't apply to your situation,

Tim.