Files

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

27 lines
912 B
C++
Raw Permalink Normal View History

//===-- lib/Parser/debug-parser.cpp ---------------------------------------===//
2018-05-01 12:50:34 -07:00
//
// 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
2018-05-01 12:50:34 -07:00
//
//===----------------------------------------------------------------------===//
2018-05-01 12:50:34 -07:00
#include "debug-parser.h"
#include "flang/Parser/user-state.h"
#include <string>
2018-05-02 13:48:12 -07:00
namespace Fortran::parser {
std::optional<Success> DebugParser::Parse(ParseState &state) const {
2018-07-10 17:09:07 -07:00
if (auto ustate{state.userState()}) {
if (auto out{ustate->debugOutput()}) {
2018-05-02 12:07:49 -07:00
std::string note{str_, length_};
Message message{state.GetLocation(), "parser debug: %s"_en_US, note};
2018-05-04 15:03:10 -07:00
message.SetContext(state.context().get());
2018-05-02 12:07:49 -07:00
message.Emit(*out, ustate->cooked(), true);
}
}
return {Success{}};
}
} // namespace Fortran::parser