njames93 created this revision. njames93 added reviewers: alexfh, aaron.ballman, gribozavr2. Herald added subscribers: cfe-commits, xazax.hun. Herald added a project: clang. njames93 requested review of this revision.
If an configuration specifies InheritParentOption and is cached in child directories, When trying to inherit, it will keep reading the same cache directory file until it reaches the parent directory of where the config was actually stored. To stop this just set where we are searching from to where the config was actually stored when trying to inherit configs. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D92268 Files: clang-tools-extra/clang-tidy/ClangTidyOptions.cpp Index: clang-tools-extra/clang-tidy/ClangTidyOptions.cpp =================================================================== --- clang-tools-extra/clang-tidy/ClangTidyOptions.cpp +++ clang-tools-extra/clang-tidy/ClangTidyOptions.cpp @@ -275,9 +275,15 @@ } CachedOptions[Path] = *Result; - CurOptions.push_back(*Result); - if (!Result->first.InheritParentConfig.getValueOr(false)) + CurOptions.push_back(std::move(*Result)); + if (!CurOptions.back().first.InheritParentConfig.getValueOr(false)) break; + // Set search path to where the file where this config was loaded. If the + // Options were sourced from the cache, the actual source may be a parent + // directory of this. In which case we will then read a config that is + // identical to this on the next loop iteration. + // parent_path is used as OptionsSource contains directory and filename. + CurrentPath = llvm::sys::path::parent_path(CurOptions.back().second); } } // Reverse order of file configs because closer configs should have higher
Index: clang-tools-extra/clang-tidy/ClangTidyOptions.cpp =================================================================== --- clang-tools-extra/clang-tidy/ClangTidyOptions.cpp +++ clang-tools-extra/clang-tidy/ClangTidyOptions.cpp @@ -275,9 +275,15 @@ } CachedOptions[Path] = *Result; - CurOptions.push_back(*Result); - if (!Result->first.InheritParentConfig.getValueOr(false)) + CurOptions.push_back(std::move(*Result)); + if (!CurOptions.back().first.InheritParentConfig.getValueOr(false)) break; + // Set search path to where the file where this config was loaded. If the + // Options were sourced from the cache, the actual source may be a parent + // directory of this. In which case we will then read a config that is + // identical to this on the next loop iteration. + // parent_path is used as OptionsSource contains directory and filename. + CurrentPath = llvm::sys::path::parent_path(CurOptions.back().second); } } // Reverse order of file configs because closer configs should have higher
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits