llvm-project/clang/lib/Tooling/DumpTool
Jan Svoboda 555a817d1d [clang] NFC: Extract DiagnosticOptions parsing
The way we parse `DiagnosticOptions` is a bit involved.

`DiagnosticOptions` are parsed as part of the cc1-parsing function `CompilerInvocation::CreateFromArgs` which takes `DiagnosticsEngine` as an argument to be able to report errors in command-line arguments. But to create `DiagnosticsEngine`, `DiagnosticOptions` are needed. This is solved by exposing the `ParseDiagnosticArgs` to clients and making its `DiagnosticsEngine` argument optional, essentially breaking the dependency cycle.

The `ParseDiagnosticArgs` function takes `llvm::opt::ArgList &`, which each client needs to create from the command-line (typically represented as `std::vector<const char *>`). Creating this data structure in this context is somewhat particular. This code pattern is copy-pasted in some places across the upstream code base and also in downstream repos. To make things a bit more uniform, this patch extracts the code into a new reusable function: `CreateAndPopulateDiagOpts`.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D108918
2021-09-02 14:37:14 +02:00
..
APIData.h [AST] Add DeclarationNameInfo to node introspection 2021-04-25 12:12:03 +01:00
ASTSrcLocProcessor.cpp Support: Stop using F_{None,Text,Append} compatibility synonyms, NFC 2021-04-30 11:00:03 -07:00
ASTSrcLocProcessor.h [AST] Add TypeLoc support to node introspection 2021-04-17 22:58:02 +01:00
CMakeLists.txt [AST] Add generator for source location introspection 2021-03-15 10:52:44 +00:00
ClangSrcLocDump.cpp [clang] NFC: Extract DiagnosticOptions parsing 2021-09-02 14:37:14 +02:00
generate_cxx_src_locs.py [AST] Add DeclarationNameInfo to node introspection 2021-04-25 12:12:03 +01:00