1 //===-- Lower/Todo.h --------------------------------------------*- C++ -*-===//
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 //===----------------------------------------------------------------------===//
8 //
9 // Coding style: https://mlir.llvm.org/getting_started/DeveloperGuide/
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef FORTRAN_LOWER_TODO_H
14 #define FORTRAN_LOWER_TODO_H
15 
16 #include "llvm/Support/ErrorHandling.h"
17 #include "llvm/Support/raw_ostream.h"
18 #include <cstdlib>
19 
20 // This is throw-away code used to mark areas of the code that have not yet been
21 // developed.
22 
23 #undef TODO
24 
25 #ifdef NDEBUG
26 
27 // In a release build, just give a message and exit.
28 #define TODO(ToDoMsg)                                                          \
29   do {                                                                         \
30     llvm::errs() << __FILE__ << ':' << __LINE__ << ": not yet implemented "    \
31                  << ToDoMsg << '\n';                                           \
32     std::exit(1);                                                              \
33   } while (false)
34 
35 #else
36 
37 #undef TODOQUOTE
38 #define TODOQUOTE(X) #X
39 
40 // In a developer build, print a message and give a backtrace.
41 #define TODO(ToDoMsg)                                                          \
42   do {                                                                         \
43     llvm::report_fatal_error(                                                  \
44         __FILE__ ":" TODOQUOTE(__LINE__) ": not yet implemented " ToDoMsg);    \
45   } while (false)
46 
47 #endif
48 
49 #endif // FORTRAN_LOWER_TODO_H
50