[clang-tools-extra] [clang-tidy] Return error code on config parse error (PR #136167)
Carlos Galvez via cfe-commits
cfe-commits at lists.llvm.org
Mon May 26 11:57:17 PDT 2025
================
@@ -265,8 +265,16 @@ const ClangTidyOptions &ClangTidyContext::getOptions() const {
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);
+ ClangTidyOptions defaultOptions = ClangTidyOptions::getDefaults();
+ llvm::ErrorOr<ClangTidyOptions> fileOptions =
+ OptionsProvider->getOptions(File);
+
+ // If there was an error parsing the options, just use the default options.
----------------
carlosgalvezp wrote:
Shouldn't we fail hard/propagate the error further here? Returning the default options hides the problem for the user.
https://github.com/llvm/llvm-project/pull/136167
More information about the cfe-commits
mailing list