[clang-tools-extra] [clang-tidy] Return error code on config parse error (PR #136167)
Galen Elias via cfe-commits
cfe-commits at lists.llvm.org
Thu May 1 12:42:21 PDT 2025
================
@@ -266,7 +266,7 @@ ClangTidyOptions ClangTidyContext::getOptionsForFile(StringRef File) const {
// Merge options on top of getDefaults() as a safeguard against options with
// unset values.
return ClangTidyOptions::getDefaults().merge(
- OptionsProvider->getOptions(File), 0);
+ *OptionsProvider->getOptions(File), 0);
----------------
galenelias wrote:
Ok, so my current plan is:
* Loop through all input files in clangTidyMain to explicitly validate configs for each input file and be able to return an error code there if a failure is found.
* In this method (`ClangTidyContext::getOptionsForFile`) just return the default config options if an error is found, which is similar to the behavior before this PR. It seems like trying to make getOptionsForFile return an ErrorOr object and handle that at each call site is very cumbersome and leads to a lot of non-obvious failure modes that need to be resolved.
https://github.com/llvm/llvm-project/pull/136167
More information about the cfe-commits
mailing list