| OLD | NEW |
| 1 //===- TableGen.cpp - Top-Level TableGen implementation -------------------===// | 1 //===- TableGen.cpp - Top-Level TableGen implementation -------------------===// |
| 2 // | 2 // |
| 3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 // | 9 // |
| 10 // TableGen is a tool which can be used to build up a description of something, | 10 // TableGen is a tool which can be used to build up a description of something, |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 DependFilename("d", cl::desc("Dependency filename"), cl::value_desc("filename"
), | 180 DependFilename("d", cl::desc("Dependency filename"), cl::value_desc("filename"
), |
| 181 cl::init("")); | 181 cl::init("")); |
| 182 | 182 |
| 183 cl::opt<std::string> | 183 cl::opt<std::string> |
| 184 InputFilename(cl::Positional, cl::desc("<input file>"), cl::init("-")); | 184 InputFilename(cl::Positional, cl::desc("<input file>"), cl::init("-")); |
| 185 | 185 |
| 186 cl::list<std::string> | 186 cl::list<std::string> |
| 187 IncludeDirs("I", cl::desc("Directory of include files"), | 187 IncludeDirs("I", cl::desc("Directory of include files"), |
| 188 cl::value_desc("directory"), cl::Prefix); | 188 cl::value_desc("directory"), cl::Prefix); |
| 189 | 189 |
| 190 cl::list<std::string> |
| 191 PreProcDefines("D", cl::desc("Tablegen preprocessor defines to include"), |
| 192 cl::value_desc("symbol"), cl::Prefix); |
| 193 |
| 190 cl::opt<std::string> | 194 cl::opt<std::string> |
| 191 ClangComponent("clang-component", | 195 ClangComponent("clang-component", |
| 192 cl::desc("Only use warnings from specified component"), | 196 cl::desc("Only use warnings from specified component"), |
| 193 cl::value_desc("component"), cl::Hidden); | 197 cl::value_desc("component"), cl::Hidden); |
| 194 } | 198 } |
| 195 | 199 |
| 196 | 200 |
| 197 int main(int argc, char **argv) { | 201 int main(int argc, char **argv) { |
| 198 RecordKeeper Records; | 202 RecordKeeper Records; |
| 199 | 203 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 212 } | 216 } |
| 213 MemoryBuffer *F = File.take(); | 217 MemoryBuffer *F = File.take(); |
| 214 | 218 |
| 215 // Tell SrcMgr about this buffer, which is what TGParser will pick up. | 219 // Tell SrcMgr about this buffer, which is what TGParser will pick up. |
| 216 SrcMgr.AddNewSourceBuffer(F, SMLoc()); | 220 SrcMgr.AddNewSourceBuffer(F, SMLoc()); |
| 217 | 221 |
| 218 // Record the location of the include directory so that the lexer can find | 222 // Record the location of the include directory so that the lexer can find |
| 219 // it later. | 223 // it later. |
| 220 SrcMgr.setIncludeDirs(IncludeDirs); | 224 SrcMgr.setIncludeDirs(IncludeDirs); |
| 221 | 225 |
| 222 TGParser Parser(SrcMgr, Records); | 226 TGParser Parser(SrcMgr, Records, PreProcDefines); |
| 223 | 227 |
| 224 if (Parser.ParseFile()) | 228 if (Parser.ParseFile()) |
| 225 return 1; | 229 return 1; |
| 226 | 230 |
| 227 std::string Error; | 231 std::string Error; |
| 228 tool_output_file Out(OutputFilename.c_str(), Error); | 232 tool_output_file Out(OutputFilename.c_str(), Error); |
| 229 if (!Error.empty()) { | 233 if (!Error.empty()) { |
| 230 errs() << argv[0] << ": error opening " << OutputFilename | 234 errs() << argv[0] << ": error opening " << OutputFilename |
| 231 << ":" << Error << "\n"; | 235 << ":" << Error << "\n"; |
| 232 return 1; | 236 return 1; |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 } catch (const std::string &Error) { | 398 } catch (const std::string &Error) { |
| 395 PrintError(Error); | 399 PrintError(Error); |
| 396 } catch (const char *Error) { | 400 } catch (const char *Error) { |
| 397 PrintError(Error); | 401 PrintError(Error); |
| 398 } catch (...) { | 402 } catch (...) { |
| 399 errs() << argv[0] << ": Unknown unexpected exception occurred.\n"; | 403 errs() << argv[0] << ": Unknown unexpected exception occurred.\n"; |
| 400 } | 404 } |
| 401 | 405 |
| 402 return 1; | 406 return 1; |
| 403 } | 407 } |
| OLD | NEW |