diff options
author | Caroline Concatto <caroline.concatto@arm.com> | 2020-02-28 15:11:03 +0000 |
---|---|---|
committer | Caroline Concatto <caroline.concatto@arm.com> | 2020-03-19 07:54:36 +0000 |
commit | 8670e49901d116b2094aeb0a5117edef9e69cdcf (patch) | |
tree | d6d88cdf50c3a747381d30a3f86ca451864b275f /flang/lib/Parser/token-sequence.cpp | |
parent | fc23a1bb79a54d401c1af8cfd3edeccf39d2e474 (diff) | |
download | llvm-8670e49901d116b2094aeb0a5117edef9e69cdcf.zip llvm-8670e49901d116b2094aeb0a5117edef9e69cdcf.tar.gz llvm-8670e49901d116b2094aeb0a5117edef9e69cdcf.tar.bz2 |
[flang] [LLVMify F18] Replace the use std::ostream with LLVM streams llvm::ostream
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@a3507d44b8911e6024033aa583c1dc54e0eb89fd
Reviewed-on: https://github.com/flang-compiler/f18/pull/1047
Diffstat (limited to 'flang/lib/Parser/token-sequence.cpp')
-rw-r--r-- | flang/lib/Parser/token-sequence.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/flang/lib/Parser/token-sequence.cpp b/flang/lib/Parser/token-sequence.cpp index 23aa450..235a4a4 100644 --- a/flang/lib/Parser/token-sequence.cpp +++ b/flang/lib/Parser/token-sequence.cpp @@ -8,6 +8,7 @@ #include "token-sequence.h" #include "flang/Parser/characters.h" +#include "llvm/Support/raw_ostream.h" namespace Fortran::parser { @@ -123,7 +124,7 @@ void TokenSequence::Put(const std::string &s, Provenance provenance) { Put(s.data(), s.size(), provenance); } -void TokenSequence::Put(const std::stringstream &ss, Provenance provenance) { +void TokenSequence::Put(llvm::raw_string_ostream &ss, Provenance provenance) { Put(ss.str(), provenance); } @@ -248,7 +249,7 @@ void TokenSequence::Emit(CookedSource &cooked) const { cooked.PutProvenanceMappings(provenances_); } -void TokenSequence::Dump(std::ostream &o) const { +void TokenSequence::Dump(llvm::raw_ostream &o) const { o << "TokenSequence has " << char_.size() << " chars; nextStart_ " << nextStart_ << '\n'; for (std::size_t j{0}; j < start_.size(); ++j) { |