[LoopReroll] Add an extra defensive check to avoid SCEV assertion.
[llvm-project.git] / flang / lib / Parser / debug-parser.h
blob3c0079bf623cb919ce95c2c34d69d1d8b292fdd8
1 //===-- lib/Parser/debug-parser.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 //===----------------------------------------------------------------------===//
9 #ifndef FORTRAN_PARSER_DEBUG_PARSER_H_
10 #define FORTRAN_PARSER_DEBUG_PARSER_H_
12 // Implements the parser with syntax "(YOUR MESSAGE HERE)"_debug for use
13 // in temporary modifications to the grammar intended for tracing the
14 // flow of the parsers. Not to be used in production.
16 #include "basic-parsers.h"
17 #include "flang/Parser/parse-state.h"
18 #include <cstddef>
19 #include <optional>
21 namespace Fortran::parser {
23 class DebugParser {
24 public:
25 using resultType = Success;
26 constexpr DebugParser(const DebugParser &) = default;
27 constexpr DebugParser(const char *str, std::size_t n)
28 : str_{str}, length_{n} {}
29 std::optional<Success> Parse(ParseState &) const;
31 private:
32 const char *const str_;
33 const std::size_t length_;
36 constexpr DebugParser operator""_debug(const char str[], std::size_t n) {
37 return DebugParser{str, n};
39 } // namespace Fortran::parser
40 #endif // FORTRAN_PARSER_DEBUG_PARSER_H_