[clang] [WIP] Implement `-dump-deserialized-declaration-ranges` flag. (PR #133910)
Ilya Biryukov via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 4 06:16:29 PDT 2025
================
@@ -121,6 +267,26 @@ FrontendAction::CreateWrappedASTConsumer(CompilerInstance &CI,
if (!Consumer)
return nullptr;
+ std::vector<std::unique_ptr<ASTConsumer>> Consumers;
+ llvm::StringRef DumpDeserializedDeclarationRangesPath =
+ CI.getFrontendOpts().DumpDeserializedDeclarationRangesPath;
+ if (!DumpDeserializedDeclarationRangesPath.empty()) {
+ std::error_code ErrorCode;
+ auto FileStream = std::make_unique<llvm::raw_fd_ostream>(
+ DumpDeserializedDeclarationRangesPath, ErrorCode,
+ llvm::sys::fs::OF_None);
+ if (!ErrorCode) {
+ auto Printer = std::make_unique<DeserializedDeclsLineRangePrinter>(
+ CI.getSourceManager(), std::move(FileStream));
+ Consumers.push_back(std::move(Printer));
----------------
ilya-biryukov wrote:
NIT: inline Printer, `Consumers.push_back(std::make_unique...)`
https://github.com/llvm/llvm-project/pull/133910
More information about the cfe-commits
mailing list