Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No default constructor in llvm::AttrBuilder for Code generation (Chapter 5) #23

Open
Fare9 opened this issue Jan 18, 2023 · 0 comments
Open

Comments

@Fare9
Copy link

Fare9 commented Jan 18, 2023

In newer versions of LLVM (from LLVM 14), there's no default AttrBuilder constructor, it's necessary to add a LLVMContext.

Modify:

llvm::AttrBuilder Attr;
llvm::TypeSize Sz =
CGM.getModule()->getDataLayout().getTypeStoreSize(
CGM.convertType(FP->getType()));
Attr.addDereferenceableAttr(Sz);
Attr.addAttribute(llvm::Attribute::NoCapture);
Arg->addAttrs(Attr);

For:

llvm::AttrBuilder Attr(CGM.getLLVMCtx()); // add context here from CGM object
llvm::TypeSize Sz = CGM.getModule()->getDataLayout().getTypeStoreSize(CGM.convertType(FP->getType()));
Attr.addDereferenceableAttr(Sz);
Attr.addAttribute(llvm::Attribute::NoCapture);
Arg->addAttrs(Attr);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant