File tree Expand file tree Collapse file tree 2 files changed +24
-12
lines changed Expand file tree Collapse file tree 2 files changed +24
-12
lines changed Original file line number Diff line number Diff line change @@ -118,6 +118,7 @@ int test_main(int argc, char const** argv)
118118 return EXIT_SUCCESS;
119119}
120120
121+ #ifdef _NDEBUG
121122static void reportUnhandledException (
122123 std::exception const & ex)
123124{
@@ -126,12 +127,16 @@ static void reportUnhandledException(
126127 report::error (" Unhandled exception: {}\n " , ex.what ());
127128 sys::PrintStackTrace (llvm::errs ());
128129}
130+ #endif
129131
130132} // mrdocs
131133} // clang
132134
133135int main (int argc, char const ** argv)
134136{
137+ #ifndef _NDEBUG
138+ return clang::mrdocs::test_main (argc, argv);
139+ #else
135140 try
136141 {
137142 return clang::mrdocs::test_main (argc, argv);
@@ -146,4 +151,5 @@ int main(int argc, char const** argv)
146151 clang::mrdocs::reportUnhandledException (ex);
147152 }
148153 return EXIT_FAILURE;
154+ #endif
149155}
Original file line number Diff line number Diff line change @@ -153,6 +153,7 @@ mrdocs_main(int argc, char const** argv)
153153 return EXIT_SUCCESS;
154154}
155155
156+ #ifdef _NDEBUG
156157static
157158void
158159reportUnhandledException (
@@ -163,24 +164,29 @@ reportUnhandledException(
163164 report::fatal (" Unhandled exception: {}\n " , ex.what ());
164165 sys::PrintStackTrace (llvm::errs ());
165166}
167+ #endif
166168
167169} // clang::mrdocs
168170
169171int
170172main (int argc, char const ** argv)
171173{
172- // try
173- // {
174+ #ifndef _NDEBUG
175+ return clang::mrdocs::mrdocs_main (argc, argv);
176+ #else
177+ try
178+ {
174179 return clang::mrdocs::mrdocs_main (argc, argv);
175- // }
176- // catch(clang::mrdocs::Exception const& ex)
177- // {
180+ }
181+ catch (clang::mrdocs::Exception const & ex)
182+ {
178183 // Thrown Exception should never get here.
179- // clang::mrdocs::reportUnhandledException(ex);
180- // }
181- // catch(std::exception const& ex)
182- // {
183- // clang::mrdocs::reportUnhandledException(ex);
184- // }
185- // return EXIT_FAILURE;
184+ clang::mrdocs::reportUnhandledException (ex);
185+ }
186+ catch (std::exception const & ex)
187+ {
188+ clang::mrdocs::reportUnhandledException (ex);
189+ }
190+ return EXIT_FAILURE;
191+ #endif
186192}
You can’t perform that action at this time.
0 commit comments