aboutsummaryrefslogtreecommitdiff
path: root/clang-tools-extra/clang-query/tool/ClangQuery.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clang-query/tool/ClangQuery.cpp')
-rw-r--r--clang-tools-extra/clang-query/tool/ClangQuery.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/clang-tools-extra/clang-query/tool/ClangQuery.cpp b/clang-tools-extra/clang-query/tool/ClangQuery.cpp
index 80e1c60..5cfa0ac 100644
--- a/clang-tools-extra/clang-query/tool/ClangQuery.cpp
+++ b/clang-tools-extra/clang-query/tool/ClangQuery.cpp
@@ -69,13 +69,16 @@ bool runCommandsInFile(const char *ExeName, std::string const &FileName,
llvm::errs() << ExeName << ": cannot open " << FileName << "\n";
return 1;
}
- while (Input.good()) {
- std::string Line;
- std::getline(Input, Line);
- QueryRef Q = QueryParser::parse(Line, QS);
+ std::string FileContent((std::istreambuf_iterator<char>(Input)),
+ std::istreambuf_iterator<char>());
+
+ StringRef FileContentRef(FileContent);
+ while (!FileContentRef.empty()) {
+ QueryRef Q = QueryParser::parse(FileContentRef, QS);
if (!Q->run(llvm::outs(), QS))
return true;
+ FileContentRef = Q->RemainingContent;
}
return false;
}