OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <algorithm> | 5 #include <algorithm> |
6 #include <iterator> | 6 #include <iterator> |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 bool ret = base::ReadFileToString(UTF8ToFilePath(args[1]), &input); | 103 bool ret = base::ReadFileToString(UTF8ToFilePath(args[1]), &input); |
104 if (!ret) { | 104 if (!ret) { |
105 Err(Location(), "Input file " + args[1] + " not found.").PrintToStdout(); | 105 Err(Location(), "Input file " + args[1] + " not found.").PrintToStdout(); |
106 return 1; | 106 return 1; |
107 } | 107 } |
108 | 108 |
109 Setup* setup = new Setup; | 109 Setup* setup = new Setup; |
110 if (!setup->DoSetup(args[0], false) || !setup->Run()) | 110 if (!setup->DoSetup(args[0], false) || !setup->Run()) |
111 return 1; | 111 return 1; |
112 | 112 |
113 Analyzer analyzer(setup->builder()); | |
114 | |
115 Err err; | 113 Err err; |
116 std::string output = Analyzer(setup->builder()).Analyze(input, &err); | 114 Analyzer analyzer(setup->build_settings(), setup->builder()); |
| 115 std::string output = analyzer.Analyze(input, &err); |
117 if (err.has_error()) { | 116 if (err.has_error()) { |
118 err.PrintToStdout(); | 117 err.PrintToStdout(); |
119 return 1; | 118 return 1; |
120 } | 119 } |
121 | 120 |
122 WriteFile(UTF8ToFilePath(args[2]), output, &err); | 121 WriteFile(UTF8ToFilePath(args[2]), output, &err); |
123 if (err.has_error()) { | 122 if (err.has_error()) { |
124 err.PrintToStdout(); | 123 err.PrintToStdout(); |
125 return 1; | 124 return 1; |
126 } | 125 } |
127 | 126 |
128 return 0; | 127 return 0; |
129 } | 128 } |
130 | 129 |
131 } // namespace commands | 130 } // namespace commands |
OLD | NEW |