
This patch replaces the occurrence of std::ostream by llvm::raw_ostream. In LLVM Coding Standards[1] "All new code should use raw_ostream instead of ostream".[1] As a consequence, this patch also replaces the use of: std::stringstream by llvm::raw_string_ostream or llvm::raw_ostream* std::ofstream by llvm::raw_fd_ostream std::endl by '\n' and flush()[2] std::cout by llvm::outs() and std::cerr by llvm::errs() It also replaces std::strerro by llvm::sys::StrError** , but NOT in Fortran runtime libraries *std::stringstream were replaced by llvm::raw_ostream in all methods that used std::stringstream as a parameter. Moreover, it removes the pointers to these streams. [1]https://llvm.org/docs/CodingStandards.html [2]https://releases.llvm.org/2.5/docs/CodingStandards.html#ll_avoidendl Signed-off-by: Caroline Concatto <caroline.concatto@arm.com> Running clang-format-7 Signed-off-by: Caroline Concatto <caroline.concatto@arm.com> Removing residue of ostream library Signed-off-by: Caroline Concatto <caroline.concatto@arm.com> Original-commit: flang-compiler/f18@a3507d44b8 Reviewed-on: https://github.com/flang-compiler/f18/pull/1047
27 lines
883 B
C++
27 lines
883 B
C++
//===-- lib/Parser/debug-parser.cpp ---------------------------------------===//
|
|
//
|
|
// 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "debug-parser.h"
|
|
#include "flang/Parser/user-state.h"
|
|
#include <string>
|
|
|
|
namespace Fortran::parser {
|
|
|
|
std::optional<Success> DebugParser::Parse(ParseState &state) const {
|
|
if (auto ustate{state.userState()}) {
|
|
if (auto out{ustate->debugOutput()}) {
|
|
std::string note{str_, length_};
|
|
Message message{state.GetLocation(), "parser debug: %s"_en_US, note};
|
|
message.SetContext(state.context().get());
|
|
message.Emit(*out, ustate->cooked(), true);
|
|
}
|
|
}
|
|
return {Success{}};
|
|
}
|
|
}
|