forked from OSchip/llvm-project
[dllexport] odr-use constexpr default args for constructor closures
InstantiateDefaultCtorDefaultArgs() is supposed to mark default constructor args as odr-used, since those args will be used when emitting the constructor closure. However, constexpr vars were not getting odr-used since DoMarkVarDeclReferenced() defers them in MaybeODRUseExprs, and the code was calling CleanupVarDeclMarking() which discarded those uses instead of processing them. (This came up in Chromium, crbug.com/1312086) Differential revision: https://reviews.llvm.org/D123405
This commit is contained in:
parent
f018a5f6e0
commit
40ad667013
|
@ -821,7 +821,7 @@ void Sema::InstantiateDefaultCtorDefaultArgs(CXXConstructorDecl *Ctor) {
|
|||
for (unsigned I = 0; I != NumParams; ++I) {
|
||||
(void)CheckCXXDefaultArgExpr(Attr->getLocation(), Ctor,
|
||||
Ctor->getParamDecl(I));
|
||||
DiscardCleanupsInEvaluationContext();
|
||||
CleanupVarDeclMarking();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -88,3 +88,10 @@ CtorClosureOutOfLine::CtorClosureOutOfLine(const HasImplicitDtor2 &v) {}
|
|||
// CHECK-LABEL: define linkonce_odr dso_local x86_thiscallcc void @"??1HasImplicitDtor1@@QAE@XZ"
|
||||
// CHECK-LABEL: define weak_odr dso_local dllexport x86_thiscallcc void @"??_FCtorClosureOutOfLine@@QAEXXZ"
|
||||
// CHECK-LABEL: define linkonce_odr dso_local x86_thiscallcc void @"??1HasImplicitDtor2@@QAE@XZ"
|
||||
|
||||
struct SomeStruct {};
|
||||
constexpr SomeStruct kConstexprStruct;
|
||||
struct __declspec(dllexport) ConstexprDefaultArg {
|
||||
ConstexprDefaultArg(SomeStruct = kConstexprStruct) {}
|
||||
};
|
||||
// CHECK-LABEL: define weak_odr dso_local dllexport x86_thiscallcc void @"??_FConstexprDefaultArg@@QAEXXZ"
|
||||
|
|
Loading…
Reference in New Issue