diff options
| author | Chandler Carruth <chandlerc@gmail.com> | 2016-12-20 08:28:19 +0000 |
|---|---|---|
| committer | Chandler Carruth <chandlerc@gmail.com> | 2016-12-20 08:28:19 +0000 |
| commit | d7738fe6ad9739e750127080a22294df39307429 (patch) | |
| tree | 9698fe0b95d43a9d6f1566fdd999cc759f2d79f5 /clang/lib/CodeGen/CGBlocks.cpp | |
| parent | 881989cb69c405ca92ddabccea547d91491a2d14 (diff) | |
| download | bcm5719-llvm-d7738fe6ad9739e750127080a22294df39307429.tar.gz bcm5719-llvm-d7738fe6ad9739e750127080a22294df39307429.zip | |
Revert r290149: Add the alloc_size attribute to clang.
This commit fails MSan when running test/CodeGen/object-size.c in
a confusing way. After some discussion with George, it isn't really
clear what is going on here. We can make the MSan failure go away by
testing for the invalid bit, but *why* things are invalid isn't clear.
And yet, other code in the surrounding area is doing precisely this and
testing for invalid.
George is going to take a closer look at this to better understand the
nature of the failure and recommit it, for now backing it out to clean
up MSan builds.
llvm-svn: 290169
Diffstat (limited to 'clang/lib/CodeGen/CGBlocks.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CGBlocks.cpp | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp index b250b9a32b1..50a6d61e7e5 100644 --- a/clang/lib/CodeGen/CGBlocks.cpp +++ b/clang/lib/CodeGen/CGBlocks.cpp @@ -686,8 +686,6 @@ llvm::Value *CodeGenFunction::EmitBlockLiteral(const BlockExpr *blockExpr) { // If the block has no captures, we won't have a pre-computed // layout for it. if (!blockExpr->getBlockDecl()->hasCaptures()) { - if (llvm::Constant *Block = CGM.getAddrOfGlobalBlockIfEmitted(blockExpr)) - return Block; CGBlockInfo blockInfo(blockExpr->getBlockDecl(), CurFn->getName()); computeBlockInfo(CGM, this, blockInfo); blockInfo.BlockExpression = blockExpr; @@ -1049,19 +1047,9 @@ Address CodeGenFunction::GetAddrOfBlockDecl(const VarDecl *variable, return addr; } -void CodeGenModule::setAddrOfGlobalBlock(const BlockExpr *BE, - llvm::Constant *Addr) { - bool Ok = EmittedGlobalBlocks.insert(std::make_pair(BE, Addr)).second; - (void)Ok; - assert(Ok && "Trying to replace an already-existing global block!"); -} - llvm::Constant * CodeGenModule::GetAddrOfGlobalBlock(const BlockExpr *BE, StringRef Name) { - if (llvm::Constant *Block = getAddrOfGlobalBlockIfEmitted(BE)) - return Block; - CGBlockInfo blockInfo(BE->getBlockDecl(), Name); blockInfo.BlockExpression = BE; @@ -1086,11 +1074,6 @@ static llvm::Constant *buildGlobalBlock(CodeGenModule &CGM, const CGBlockInfo &blockInfo, llvm::Constant *blockFn) { assert(blockInfo.CanBeGlobal); - // Callers should detect this case on their own: calling this function - // generally requires computing layout information, which is a waste of time - // if we've already emitted this block. - assert(!CGM.getAddrOfGlobalBlockIfEmitted(blockInfo.BlockExpression) && - "Refusing to re-emit a global block."); // Generate the constants for the block literal initializer. ConstantInitBuilder builder(CGM); @@ -1120,12 +1103,9 @@ static llvm::Constant *buildGlobalBlock(CodeGenModule &CGM, /*constant*/ true); // Return a constant of the appropriately-casted type. - llvm::Type *RequiredType = + llvm::Type *requiredType = CGM.getTypes().ConvertType(blockInfo.getBlockExpr()->getType()); - llvm::Constant *Result = - llvm::ConstantExpr::getBitCast(literal, RequiredType); - CGM.setAddrOfGlobalBlock(blockInfo.BlockExpression, Result); - return Result; + return llvm::ConstantExpr::getBitCast(literal, requiredType); } void CodeGenFunction::setBlockContextParameter(const ImplicitParamDecl *D, |

