[PATCH] D88909: add Todo.h

Eric Schweitz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 6 09:43:50 PDT 2020


schweitz created this revision.
schweitz added reviewers: clementval, SouraVX, kiranchandramohan.
schweitz added a project: Flang.
Herald added a reviewer: jdoerfert.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
schweitz requested review of this revision.
Herald added a subscriber: sstefan1.

The Todo.h header file allows flang developers to mark parts of the (lowering) project as "todo" holes in the implementation. Inputs that reach these holes will cause the compiler to exit rather than silently proceed and either crash later or produce incorrect code.

This file is being adding to enable continued development and progress on the lowering of OpenMP, OpenACC, etc.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88909

Files:
  flang/include/flang/Lower/Todo.h


Index: flang/include/flang/Lower/Todo.h
===================================================================
--- /dev/null
+++ flang/include/flang/Lower/Todo.h
@@ -0,0 +1,49 @@
+//===-- Lower/Todo.h --------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// Coding style: https://mlir.llvm.org/getting_started/DeveloperGuide/
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef FORTRAN_LOWER_TODO_H
+#define FORTRAN_LOWER_TODO_H
+
+#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/raw_ostream.h"
+#include <cstdlib>
+
+// This is throw-away code used to mark areas of the code that have not yet been
+// developed.
+
+#undef TODO
+
+#ifdef NDEBUG
+
+// In a release build, just give a message and exit.
+#define TODO(ToDoMsg)                                                          \
+  do {                                                                         \
+    llvm::errs() << __FILE__ << ':' << __LINE__ << ": not yet implemented "    \
+                 << ToDoMsg << '\n';                                           \
+    std::exit(1);                                                              \
+  } while (false)
+
+#else
+
+#undef TODOQUOTE
+#define TODOQUOTE(X) #X
+
+// In a developer build, print a message and give a backtrace.
+#define TODO(ToDoMsg)                                                          \
+  do {                                                                         \
+    llvm::report_fatal_error(                                                  \
+        __FILE__ ":" TODOQUOTE(__LINE__) ": not yet implemented " ToDoMsg);    \
+  } while (false)
+
+#endif
+
+#endif // FORTRAN_LOWER_TODO_H


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88909.296486.patch
Type: text/x-patch
Size: 2005 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201006/6c6781c5/attachment.bin>


More information about the llvm-commits mailing list