[LoopReroll] Add an extra defensive check to avoid SCEV assertion.
[llvm-project.git] / flang / lib / Parser / debug-parser.cpp
blobaf5da091cde63976c2d1a0ef480eb769ad5741a4
1 //===-- lib/Parser/debug-parser.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 "debug-parser.h"
10 #include "flang/Parser/user-state.h"
11 #include <string>
13 namespace Fortran::parser {
15 std::optional<Success> DebugParser::Parse(ParseState &state) const {
16 if (auto ustate{state.userState()}) {
17 if (auto out{ustate->debugOutput()}) {
18 std::string note{str_, length_};
19 Message message{state.GetLocation(), "parser debug: %s"_en_US, note};
20 message.SetContext(state.context().get());
21 message.Emit(*out, ustate->allCooked(), true);
24 return Success{};
26 } // namespace Fortran::parser