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

[Clang] Fix argument extensions in CGBlocks.cpp #111740

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions clang/lib/CodeGen/CGBlocks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2842,6 +2842,8 @@ llvm::FunctionCallee CodeGenModule::getBlockObjectDispose() {
llvm::FunctionType *fty
= llvm::FunctionType::get(VoidTy, args, false);
BlockObjectDispose = CreateRuntimeFunction(fty, "_Block_object_dispose");
// FIXME: Correct signedness of extension??
BlockObjectDispose.getAsFunction()->addParamAttr(1, llvm::Attribute::SExt);
configureBlocksRuntimeObject(
*this, cast<llvm::Constant>(BlockObjectDispose.getCallee()));
return BlockObjectDispose;
Expand All @@ -2855,6 +2857,7 @@ llvm::FunctionCallee CodeGenModule::getBlockObjectAssign() {
llvm::FunctionType *fty
= llvm::FunctionType::get(VoidTy, args, false);
BlockObjectAssign = CreateRuntimeFunction(fty, "_Block_object_assign");
BlockObjectAssign.getAsFunction()->addParamAttr(2, llvm::Attribute::SExt);
configureBlocksRuntimeObject(
*this, cast<llvm::Constant>(BlockObjectAssign.getCallee()));
return BlockObjectAssign;
Expand Down
3 changes: 3 additions & 0 deletions llvm/include/llvm/IR/DerivedTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

namespace llvm {

class Function;
class Value;
class APInt;
class LLVMContext;
Expand Down Expand Up @@ -189,6 +190,8 @@ class FunctionCallee {

explicit operator bool() { return Callee; }

Function *getAsFunction();

private:
FunctionType *FnTy = nullptr;
Value *Callee = nullptr;
Expand Down
8 changes: 8 additions & 0 deletions llvm/lib/IR/Type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,14 @@ bool FunctionType::isValidArgumentType(Type *ArgTy) {
return ArgTy->isFirstClassType();
}

//===----------------------------------------------------------------------===//
// FunctionCallee Implementation
//===----------------------------------------------------------------------===//

Function* FunctionCallee::getAsFunction() {
return cast<llvm::Function>(Callee);
}

//===----------------------------------------------------------------------===//
// StructType Implementation
//===----------------------------------------------------------------------===//
Expand Down
Loading