From 04c6851cd6053c638e68bf1d7b99dda14ea267fb Mon Sep 17 00:00:00 2001 From: Mike Stump Date: Thu, 21 Jan 2010 15:20:48 +0000 Subject: Speed up compilation by avoiding generating exceptional edges from CallExprs as those edges help cause a n^2 explosion in the number of destructor calls. Other consumers, such as static analysis, that would like to have more a more complete CFG can select the inclusion of those edges as CFG build time. This also fixes up the two compilation users of CFGs to be tolerant of having or not having those edges. All catch code is assumed be to live if we didn't generate the exceptional edges for CallExprs. llvm-svn: 94074 --- clang/test/SemaCXX/warn-unreachable.cpp | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 clang/test/SemaCXX/warn-unreachable.cpp (limited to 'clang/test') diff --git a/clang/test/SemaCXX/warn-unreachable.cpp b/clang/test/SemaCXX/warn-unreachable.cpp new file mode 100644 index 00000000000..13a82f4f183 --- /dev/null +++ b/clang/test/SemaCXX/warn-unreachable.cpp @@ -0,0 +1,35 @@ +// RUN: %clang %s -fsyntax-only -Xclang -verify -fblocks -Wunreachable-code -Wno-unused-value + +int live(); +int dead(); +int liveti() throw(int); +int (*livetip)() throw(int); + +int test1() { + try { + live(); + } catch (int i) { + live(); + } + return 1; +} + +void test2() { + try { + live(); + } catch (int i) { + live(); + } + try { + liveti(); + } catch (int i) { + live(); + } + try { + livetip(); + } catch (int i) { + live(); + } + throw 1; + dead(); // expected-warning {{will never be executed}} +} -- cgit v1.2.3