Add a clear() method to PriorityQueue.
[oota-llvm.git] / lib / Transforms / IPO / PruneEH.cpp
index ceb9e3e54e81c3e87cdb4f14611f350a6dc2c009..d4194a1060eec96c76580b9ad51cb5abebf4c3c4 100644 (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.
   //
@@ -74,7 +76,7 @@ bool PruneEH::runOnSCC(const std::vector<CallGraphNode *> &SCC) {
     if (F == 0) {
       SCCMightUnwind = true;
       SCCMightReturn = true;
-    } else if (F->isDeclaration()) {
+    } else if (F->isDeclaration() || F->hasWeakLinkage()) {
       SCCMightUnwind |= !F->doesNotThrow();
       SCCMightReturn |= !F->doesNotReturn();
     } else {