forked from OSchip/llvm-project
When marking derived classes' virtual methods ODR-used in order to trigger
instantiation in order to permit devirtualization later in codegen, skip over pure functions since those can't be devirtualization targets. llvm-svn: 175116
This commit is contained in:
parent
3cfba5bf13
commit
b7444cd11e
|
@ -11179,7 +11179,7 @@ static void MarkExprReferenced(Sema &SemaRef, SourceLocation Loc,
|
||||||
if (!MostDerivedClassDecl)
|
if (!MostDerivedClassDecl)
|
||||||
return;
|
return;
|
||||||
CXXMethodDecl *DM = MD->getCorrespondingMethodInClass(MostDerivedClassDecl);
|
CXXMethodDecl *DM = MD->getCorrespondingMethodInClass(MostDerivedClassDecl);
|
||||||
if (!DM)
|
if (!DM || DM->isPure())
|
||||||
return;
|
return;
|
||||||
SemaRef.MarkAnyDeclReferenced(Loc, DM, OdrUse);
|
SemaRef.MarkAnyDeclReferenced(Loc, DM, OdrUse);
|
||||||
}
|
}
|
||||||
|
|
|
@ -306,3 +306,20 @@ namespace test12 {
|
||||||
Cls2 obj1((T7())); // expected-note {{used here}}
|
Cls2 obj1((T7())); // expected-note {{used here}}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace test13 {
|
||||||
|
namespace {
|
||||||
|
struct X {
|
||||||
|
virtual void f() { }
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Y : public X {
|
||||||
|
virtual void f() = 0;
|
||||||
|
|
||||||
|
virtual void g() {
|
||||||
|
X::f();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue