Weak functions not declared non-throwing might be

replaced at linktime with a body that throws, even
if the body in this file does not.  Make PruneEH
be more conservative in this case.
g++.dg/eh/weak1.C



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51207 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dale Johannesen 2008-05-16 21:31:48 +00:00
parent 0bf7b414ae
commit 6796629611

View File

@ -64,6 +64,8 @@ bool PruneEH::runOnSCC(const std::vector<CallGraphNode *> &SCC) {
// Next, check to see if any callees might throw or if there are any external
// functions in this SCC: if so, we cannot prune any functions in this SCC.
// Definitions that are weak and not declared non-throwing might be
// overridden at linktime with something that throws, so assume that.
// If this SCC includes the unwind instruction, we KNOW it throws, so
// obviously the SCC might throw.
//
@ -71,7 +73,7 @@ bool PruneEH::runOnSCC(const std::vector<CallGraphNode *> &SCC) {
for (unsigned i = 0, e = SCC.size();
(!SCCMightUnwind || !SCCMightReturn) && i != e; ++i) {
Function *F = SCC[i]->getFunction();
if (F == 0) {
if (F == 0 || (F->hasWeakLinkage() && !F->doesNotThrow())) {
SCCMightUnwind = true;
SCCMightReturn = true;
} else if (F->isDeclaration()) {