Skip to content

Commit 3d210ed

Browse files
committed
Revert "Allow system header to provide their own implementation of some builtin"
This reverts commit 921f871 because it causes libc++ code to trigger __warn_memset_zero_len. See https://reviews.llvm.org/D71082.
1 parent 7ce2de2 commit 3d210ed

File tree

6 files changed

+1
-58
lines changed

6 files changed

+1
-58
lines changed

clang/include/clang/AST/Decl.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2309,9 +2309,6 @@ class FunctionDecl : public DeclaratorDecl,
23092309
/// true through IsAligned.
23102310
bool isReplaceableGlobalAllocationFunction(bool *IsAligned = nullptr) const;
23112311

2312-
/// Determine if this function provides an inline implementation of a builtin.
2313-
bool isInlineBuiltinDeclaration() const;
2314-
23152312
/// Determine whether this is a destroying operator delete.
23162313
bool isDestroyingOperatorDelete() const;
23172314

clang/lib/AST/Decl.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3046,14 +3046,6 @@ bool FunctionDecl::isReplaceableGlobalAllocationFunction(bool *IsAligned) const
30463046
return Params == FPT->getNumParams();
30473047
}
30483048

3049-
bool FunctionDecl::isInlineBuiltinDeclaration() const {
3050-
if (!getBuiltinID())
3051-
return false;
3052-
3053-
const FunctionDecl *Definition;
3054-
return hasBody(Definition) && Definition->isInlineSpecified();
3055-
}
3056-
30573049
bool FunctionDecl::isDestroyingOperatorDelete() const {
30583050
// C++ P0722:
30593051
// Within a class C, a single object deallocation function with signature

clang/lib/CodeGen/CGExpr.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4621,15 +4621,8 @@ RValue CodeGenFunction::EmitSimpleCallExpr(const CallExpr *E,
46214621
}
46224622

46234623
static CGCallee EmitDirectCallee(CodeGenFunction &CGF, const FunctionDecl *FD) {
4624-
46254624
if (auto builtinID = FD->getBuiltinID()) {
4626-
// Replaceable builtin provide their own implementation of a builtin. Unless
4627-
// we are in the builtin implementation itself, don't call the actual
4628-
// builtin. If we are in the builtin implementation, avoid trivial infinite
4629-
// recursion.
4630-
if (!FD->isInlineBuiltinDeclaration() ||
4631-
CGF.CurFn->getName() == FD->getName())
4632-
return CGCallee::forBuiltin(builtinID, FD);
4625+
return CGCallee::forBuiltin(builtinID, FD);
46334626
}
46344627

46354628
llvm::Constant *calleePtr = EmitFunctionDeclPointer(CGF.CGM, FD);

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1840,11 +1840,6 @@ void CodeGenModule::SetFunctionAttributes(GlobalDecl GD, llvm::Function *F,
18401840
else if (const auto *SA = FD->getAttr<SectionAttr>())
18411841
F->setSection(SA->getName());
18421842

1843-
if (FD->isInlineBuiltinDeclaration()) {
1844-
F->addAttribute(llvm::AttributeList::FunctionIndex,
1845-
llvm::Attribute::NoBuiltin);
1846-
}
1847-
18481843
if (FD->isReplaceableGlobalAllocationFunction()) {
18491844
// A replaceable global allocation function does not act like a builtin by
18501845
// default, only if it is invoked by a new-expression or delete-expression.

clang/test/CodeGen/memcpy-nobuiltin.c

Lines changed: 0 additions & 15 deletions
This file was deleted.

clang/test/CodeGen/memcpy-nobuiltin.inc

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)