Skip to content

Commit

Permalink
Unbreak the test suite after 8e8176c
Browse files Browse the repository at this point in the history
The atexit logic needs to handle functions bitcast to the right type
rather than assume that the passed in constant is literally
llvm::FunctionType.
  • Loading branch information
davezarzycki committed Jun 20, 2020
1 parent f1b8b33 commit 4292b7e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions clang/lib/CodeGen/CGDeclCXX.cpp
Expand Up @@ -276,8 +276,10 @@ void CodeGenFunction::registerGlobalDtorWithAtExit(const VarDecl &VD,

void CodeGenFunction::registerGlobalDtorWithAtExit(llvm::Constant *dtorStub) {
// extern "C" int atexit(void (*f)(void));
assert(cast<llvm::Function>(dtorStub)->getFunctionType() ==
llvm::FunctionType::get(CGM.VoidTy, false) &&
llvm::PointerType *Expected =
llvm::PointerType::get(llvm::FunctionType::get(CGM.VoidTy, false),
dtorStub->getType()->getPointerAddressSpace());
assert(dtorStub->getType() == Expected &&
"Argument to atexit has a wrong type.");

llvm::FunctionType *atexitTy =
Expand Down

0 comments on commit 4292b7e

Please sign in to comment.