[memprof] Use LineLocation in a unit test (NFC) (#116917)
[llvm-project.git] / flang / lib / Common / idioms.cpp
blob536a5c2e5479df998e76a24b874beb0611a6343f
1 //===-- lib/Common/idioms.cpp ---------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "flang/Common/idioms.h"
10 #include <cstdarg>
11 #include <cstdio>
12 #include <cstdlib>
14 namespace Fortran::common {
16 [[noreturn]] void die(const char *msg, ...) {
17 va_list ap;
18 va_start(ap, msg);
19 std::fputs("\nfatal internal error: ", stderr);
20 std::vfprintf(stderr, msg, ap);
21 va_end(ap);
22 fputc('\n', stderr);
23 std::abort();
26 } // namespace Fortran::common