summaryrefslogtreecommitdiffstats
path: root/Tests/CMakeLib/run_compile_commands.cxx
diff options
context:
space:
mode:
authorDaniel Pfeifer <daniel@pfeifer-mail.de>2016-09-01 18:02:57 (GMT)
committerBrad King <brad.king@kitware.com>2016-09-03 12:04:22 (GMT)
commit3f9c4cdf89ce00ae72a1176dbf5e68b5f1f1720e (patch)
tree7c047b9b2e5c4a59ab386076b193315572abd28b /Tests/CMakeLib/run_compile_commands.cxx
parent87e76f899693fb3c29f280b417303e899c3a38dd (diff)
downloadCMake-3f9c4cdf89ce00ae72a1176dbf5e68b5f1f1720e.zip
CMake-3f9c4cdf89ce00ae72a1176dbf5e68b5f1f1720e.tar.gz
CMake-3f9c4cdf89ce00ae72a1176dbf5e68b5f1f1720e.tar.bz2
Tests/CMakeLib: use cmsys::ifstream
Diffstat (limited to 'Tests/CMakeLib/run_compile_commands.cxx')
-rw-r--r--Tests/CMakeLib/run_compile_commands.cxx17
1 files changed, 10 insertions, 7 deletions
diff --git a/Tests/CMakeLib/run_compile_commands.cxx b/Tests/CMakeLib/run_compile_commands.cxx
index 502ffe7..529c830 100644
--- a/Tests/CMakeLib/run_compile_commands.cxx
+++ b/Tests/CMakeLib/run_compile_commands.cxx
@@ -1,6 +1,6 @@
#include "cmSystemTools.h"
-#include <fstream>
+#include <cmsys/FStream.hxx>
#include <iostream>
#include <map>
#include <stdlib.h>
@@ -26,7 +26,10 @@ public:
};
typedef std::vector<CommandType> TranslationUnitsType;
- CompileCommandParser(std::ifstream* input) { this->Input = input; }
+ CompileCommandParser(std::istream& input)
+ : Input(input)
+ {
+ }
void Parse()
{
@@ -109,8 +112,8 @@ private:
void Next()
{
- this->C = char(Input->get());
- if (this->Input->bad()) {
+ this->C = char(Input.get());
+ if (this->Input.bad()) {
ErrorExit("Unexpected end of file.");
}
}
@@ -131,13 +134,13 @@ private:
TranslationUnitsType TranslationUnits;
CommandType Command;
std::string String;
- std::ifstream* Input;
+ std::istream& Input;
};
int main()
{
- std::ifstream file("compile_commands.json");
- CompileCommandParser parser(&file);
+ cmsys::ifstream file("compile_commands.json");
+ CompileCommandParser parser(file);
parser.Parse();
for (CompileCommandParser::TranslationUnitsType::const_iterator
it = parser.GetTranslationUnits().begin(),