Hiralo added inline comments.
================ Comment at: clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp:330 if (!Config.empty()) { if (llvm::ErrorOr<ClangTidyOptions> ParsedConfig = parseConfiguration(Config)) { ---------------- Hiralo wrote: > Hiralo wrote: > > DmitryPolukhin wrote: > > > I think you can make this option much simpler if you just read file > > > content and use it or `Config` here. No changes in > > > clang-tools-extra/clang-tidy/ClangTidyOptions.h/.cpp will be required. > > Sorry, didn't get. Can you please elaborate/pseudocode? > > > > I think you can make this option much simpler if you just read file content > > and use it or `Config` here. No changes in > > clang-tools-extra/clang-tidy/ClangTidyOptions.h/.cpp will be required. > > Are you suggesting to... > (a) as per this patch have option '--config-file' (ClangTidyMain.cpp changes) > (b) read this file in ClangTidyMain.cpp itself and > (c) pass YAML o/p to code-flow-of-config option (again change only in > ClangTidyMain.cpp). > > if so... > > Shouldn't at call to tryReadConfigFile() kind of call in ClangTidyMain.cpp? > > Can you please point me to LLVM/Clang File IO calls/examples? From code point of view... within ClangTidyMain.cpp itself... code-flow may look... ``` llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> Text = llvm::MemoryBuffer::getFile(ConfigFile.c_str()); if (std::error_code EC = Text.getError()) { llvm::errs() << "Can't read " << ConfigFile << ": " << EC.message() << "\n"; } and then Configassign(ConfigFile); from then onwards it will be considered as Config values ``` Let me try implementing and test... CHANGES SINCE LAST ACTION https://reviews.llvm.org/D89936/new/ https://reviews.llvm.org/D89936 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits