mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-02 10:49:22 +00:00
[cte][NFC] Remove all references to stdlib stream headers.
Inclusion of iostream is frobidden and using other stream classes from standard library is discouraged as per https://llvm.org/docs/CodingStandards.html#include-iostream-is-forbidden Reviewed By: sammccall Differential Revision: https://reviews.llvm.org/D97771
This commit is contained in:
parent
a7cad6680b
commit
00c7d6699a
@ -33,10 +33,10 @@
|
||||
#include "clang/Tooling/Tooling.h"
|
||||
#include "llvm/LineEditor/LineEditor.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/Support/Signals.h"
|
||||
#include "llvm/Support/WithColor.h"
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
|
||||
using namespace clang;
|
||||
@ -73,16 +73,15 @@ static cl::opt<std::string> PreloadFile(
|
||||
|
||||
bool runCommandsInFile(const char *ExeName, std::string const &FileName,
|
||||
QuerySession &QS) {
|
||||
std::ifstream Input(FileName.c_str());
|
||||
if (!Input.is_open()) {
|
||||
llvm::errs() << ExeName << ": cannot open " << FileName << "\n";
|
||||
return 1;
|
||||
auto Buffer = llvm::MemoryBuffer::getFile(FileName);
|
||||
if (!Buffer) {
|
||||
llvm::errs() << ExeName << ": cannot open " << FileName << ": "
|
||||
<< Buffer.getError().message() << "\n";
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string FileContent((std::istreambuf_iterator<char>(Input)),
|
||||
std::istreambuf_iterator<char>());
|
||||
StringRef FileContentRef(Buffer.get()->getBuffer());
|
||||
|
||||
StringRef FileContentRef(FileContent);
|
||||
while (!FileContentRef.empty()) {
|
||||
QueryRef Q = QueryParser::parse(FileContentRef, QS);
|
||||
if (!Q->run(llvm::outs(), QS))
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "clang/AST/RecordLayout.h"
|
||||
#include "clang/ASTMatchers/ASTMatchFinder.h"
|
||||
#include <math.h>
|
||||
#include <sstream>
|
||||
|
||||
using namespace clang::ast_matchers;
|
||||
|
||||
@ -109,15 +108,13 @@ void StructPackAlignCheck::check(const MatchFinder::MatchResult &Result) {
|
||||
AlignedAttr *Attribute = Struct->getAttr<AlignedAttr>();
|
||||
std::string NewAlignQuantity = std::to_string((int)NewAlign.getQuantity());
|
||||
if (Attribute) {
|
||||
std::ostringstream FixItString;
|
||||
FixItString << "aligned(" << NewAlignQuantity << ")";
|
||||
FixIt =
|
||||
FixItHint::CreateReplacement(Attribute->getRange(), FixItString.str());
|
||||
FixIt = FixItHint::CreateReplacement(
|
||||
Attribute->getRange(),
|
||||
(Twine("aligned(") + NewAlignQuantity + ")").str());
|
||||
} else {
|
||||
std::ostringstream FixItString;
|
||||
FixItString << " __attribute__((aligned(" << NewAlignQuantity << ")))";
|
||||
FixIt = FixItHint::CreateInsertion(Struct->getEndLoc().getLocWithOffset(1),
|
||||
FixItString.str());
|
||||
FixIt = FixItHint::CreateInsertion(
|
||||
Struct->getEndLoc().getLocWithOffset(1),
|
||||
(Twine(" __attribute__((aligned(") + NewAlignQuantity + ")))").str());
|
||||
}
|
||||
|
||||
// And suggest the minimum power-of-two alignment for the struct as a whole
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <sstream>
|
||||
|
||||
using namespace clang::ast_matchers;
|
||||
|
||||
|
@ -13,8 +13,6 @@
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/Support/Path.h"
|
||||
#include "llvm/Support/Regex.h"
|
||||
#include <fstream>
|
||||
#include <streambuf>
|
||||
#include <string>
|
||||
|
||||
const char *IndexFilename;
|
||||
@ -34,9 +32,15 @@ std::unique_ptr<SymbolIndex> buildDex() {
|
||||
|
||||
// Reads JSON array of serialized FuzzyFindRequest's from user-provided file.
|
||||
std::vector<FuzzyFindRequest> extractQueriesFromLogs() {
|
||||
std::ifstream InputStream(RequestsFilename);
|
||||
std::string Log((std::istreambuf_iterator<char>(InputStream)),
|
||||
std::istreambuf_iterator<char>());
|
||||
|
||||
auto Buffer = llvm::MemoryBuffer::getFile(RequestsFilename);
|
||||
if (!Buffer) {
|
||||
llvm::errs() << "Error cannot open JSON request file:" << RequestsFilename
|
||||
<< ": " << Buffer.getError().message() << "\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
StringRef Log = Buffer.get()->getBuffer();
|
||||
|
||||
std::vector<FuzzyFindRequest> Requests;
|
||||
auto JSONArray = llvm::json::parse(Log);
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "ClangdServer.h"
|
||||
#include "support/ThreadsafeFS.h"
|
||||
#include <cstdio>
|
||||
#include <sstream>
|
||||
|
||||
using namespace clang::clangd;
|
||||
|
||||
|
@ -39,7 +39,6 @@
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <chrono>
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
@ -247,7 +247,6 @@
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/Support/Path.h"
|
||||
#include <algorithm>
|
||||
#include <fstream>
|
||||
#include <iterator>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
Loading…
Reference in New Issue
Block a user