Merge commit 30588a739 from llvm git (by Erich Keane):
Make target features check work with ctor and dtor- The problem was reported in PR45468, applying target features to an always_inline constructor/destructor runs afoul of GlobalDecl construction assert when checking for target-feature compatibility. The core problem is fixed by using the version of the check that takes a FunctionDecl rather than the GlobalDecl. However, while writing the test, I discovered that source locations weren't properly set for this check on ctors/dtors. This patch also fixes constructors and CALLED destructors. Unfortunately, it doesn't seem too possible to get a meaningful source location for a 'cleanup' destructor, so those are still 'frontend' level errors unfortunately. A fixme was added to the test to cover that situation. This should fix 'Assertion failed: (!isa<CXXConstructorDecl>(D) && "Use other ctor with ctor decls!"), function Init, file /usr/src/contrib/llvm-project/clang/include/clang/AST/GlobalDecl.h, line 45' when compiling the security/botan2 port. PR: 245550 MFC after: 6 weeks X-MFC-With: 358851
This commit is contained in:
parent
d303324bad
commit
c3ca3130e2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=359826
@ -2157,7 +2157,7 @@ void CodeGenFunction::EmitCXXConstructorCall(const CXXConstructorDecl *D,
|
||||
const CGFunctionInfo &Info = CGM.getTypes().arrangeCXXConstructorCall(
|
||||
Args, D, Type, ExtraArgs.Prefix, ExtraArgs.Suffix, PassPrototypeArgs);
|
||||
CGCallee Callee = CGCallee::forDirect(CalleePtr, GlobalDecl(D, Type));
|
||||
EmitCall(Info, Callee, ReturnValueSlot(), Args);
|
||||
EmitCall(Info, Callee, ReturnValueSlot(), Args, nullptr, Loc);
|
||||
|
||||
// Generate vtable assumptions if we're constructing a complete object
|
||||
// with a vtable. We don't do this for base subobjects for two reasons:
|
||||
|
@ -112,7 +112,8 @@ RValue CodeGenFunction::EmitCXXDestructorCall(
|
||||
commonEmitCXXMemberOrOperatorCall(*this, DtorDecl, This, ImplicitParam,
|
||||
ImplicitParamTy, CE, Args, nullptr);
|
||||
return EmitCall(CGM.getTypes().arrangeCXXStructorDeclaration(Dtor), Callee,
|
||||
ReturnValueSlot(), Args);
|
||||
ReturnValueSlot(), Args, nullptr,
|
||||
CE ? CE->getExprLoc() : SourceLocation{});
|
||||
}
|
||||
|
||||
RValue CodeGenFunction::EmitCXXPseudoDestructorExpr(
|
||||
@ -380,7 +381,7 @@ RValue CodeGenFunction::EmitCXXMemberOrOperatorMemberCallExpr(
|
||||
IsArrow ? Base->getType()->getPointeeType() : Base->getType();
|
||||
EmitCXXDestructorCall(GD, Callee, This.getPointer(*this), ThisTy,
|
||||
/*ImplicitParam=*/nullptr,
|
||||
/*ImplicitParamTy=*/QualType(), nullptr);
|
||||
/*ImplicitParamTy=*/QualType(), CE);
|
||||
}
|
||||
return RValue::get(nullptr);
|
||||
}
|
||||
|
@ -2324,8 +2324,7 @@ void CodeGenFunction::checkTargetFeatures(SourceLocation Loc,
|
||||
|
||||
SmallVector<StringRef, 1> ReqFeatures;
|
||||
llvm::StringMap<bool> CalleeFeatureMap;
|
||||
CGM.getContext().getFunctionFeatureMap(CalleeFeatureMap,
|
||||
GlobalDecl(TargetDecl));
|
||||
CGM.getContext().getFunctionFeatureMap(CalleeFeatureMap, TargetDecl);
|
||||
|
||||
for (const auto &F : ParsedAttr.Features) {
|
||||
if (F[0] == '+' && CalleeFeatureMap.lookup(F.substr(1)))
|
||||
|
Loading…
Reference in New Issue
Block a user