is placed on a function that has no path to the exit block.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164244
91177308-0d34-0410-b5e6-
96231b3b80d8
}
}
+
+ // Check to make sure that the exit block is reachable
+ bool ExitUnreachable = true;
+ for (CFGBlock::const_pred_iterator PI = CFGraph->getExit().pred_begin(),
+ PE = CFGraph->getExit().pred_end(); PI != PE; ++PI) {
+ if (!(*PI)->hasNoReturnElement()) {
+ ExitUnreachable = false;
+ break;
+ }
+ }
+ // Skip the final check if the exit block is unreachable.
+ if (ExitUnreachable)
+ return;
+
CFGBlockInfo *Initial = &BlockInfo[CFGraph->getEntry().getBlockID()];
CFGBlockInfo *Final = &BlockInfo[CFGraph->getExit().getBlockID()];
}
}; // end namespace ComplexNameTest
+
+
+namespace UnreachableExitTest {
+
+class FemmeFatale {
+public:
+ FemmeFatale();
+ ~FemmeFatale() __attribute__((noreturn));
+};
+
+void exitNow() __attribute__((noreturn));
+
+Mutex fatalmu_;
+
+void test1() EXCLUSIVE_LOCKS_REQUIRED(fatalmu_) {
+ exitNow();
+}
+
+void test2() EXCLUSIVE_LOCKS_REQUIRED(fatalmu_) {
+ FemmeFatale femme;
+}
+
+bool c;
+
+void test3() EXCLUSIVE_LOCKS_REQUIRED(fatalmu_) {
+ if (c) {
+ exitNow();
+ }
+ else {
+ FemmeFatale femme;
+ }
+}
+
+} // end namespace UnreachableExitTest