2018-05-09 17:08:53 +00:00
|
|
|
---
|
2019-10-28 16:51:02 +00:00
|
|
|
# NOTE there must be no spaces before the '-', so put the comma last.
|
2025-01-10 03:16:56 +00:00
|
|
|
# The check bugprone-unchecked-optional-access is also turned on.
|
|
|
|
|
# Note that it can cause clang-tidy to hang randomly. The tracking issue
|
Disable bugprone-unchecked-optional-access as it can cause clang-tidy to hang (#115124)
Let's see if it helps https://github.com/pytorch/pytorch/issues/114913
The issues on llvm are at https://github.com/llvm/llvm-project/issues/55530 and https://github.com/llvm/llvm-project/issues/69369. In my CI test, I saw the following process hanged:
```
/pytorch/pytorch/.lintbin/clang-tidy -p=/pytorch/pytorch/build --extra-arg -I/usr/lib/llvm-11/include/openmp --extra-arg -I/opt/conda/envs/py_3.9/include/python3.9 --extra-arg -I/pytorch/pytorch/third_party/pybind11/include --extra-arg -I/usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11 --extra-arg -I/usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/x86_64-linux-gnu/c++/11 --extra-arg -I/usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/backward --extra-arg -I/usr/lib/llvm-14/lib/clang/14.0.0/include --extra-arg -I/usr/local/include --extra-arg -I/usr/include/x86_64-linux-gnu --extra-arg -I/usr/include /pytorch/pytorch/torch/csrc/autograd/python_nested_functions_manual.cpp
```
and the core dump matches the description found in https://github.com/llvm/llvm-project/issues/69369 showing the stuck in `clang::tidy::bugprone::UncheckedOptionalAccessCheck::check`:
```
#0 0x00000000030c7420 in clang::dataflow::WatchedLiteralsSolverImpl::updateWatchedLiterals() ()
#1 0x00000000030c6c2a in clang::dataflow::WatchedLiteralsSolverImpl::solve() && ()
#2 0x00000000030c6572 in clang::dataflow::WatchedLiteralsSolver::solve(llvm::DenseSet<clang::dataflow::BoolValue*, llvm::DenseMapInfo<clang::dataflow::BoolValue*, void> >) ()
#3 0x00000000030b3bd3 in clang::dataflow::DataflowAnalysisContext::querySolver(llvm::DenseSet<clang::dataflow::BoolValue*, llvm::DenseMapInfo<clang::dataflow::BoolValue*, void> >) ()
#4 0x00000000030b3ca5 in clang::dataflow::DataflowAnalysisContext::flowConditionImplies(clang::dataflow::AtomicBoolValue&, clang::dataflow::BoolValue&) ()
#5 0x00000000030b1213 in clang::dataflow::(anonymous namespace)::diagnoseUnwrapCall(clang::Expr const*, clang::Expr const*, clang::dataflow::Environment const&) ()
#6 0x00000000030b1357 in std::_Function_handler<std::vector<clang::SourceLocation, std::allocator<clang::SourceLocation> > (clang::CallExpr const*, clang::ast_matchers::MatchFinder::MatchResult const&, clang::dataflow::Environment const&), clang::dataflow::(anonymous namespace)::buildDiagnoseMatchSwitch(clang::dataflow::UncheckedOptionalAccessModelOptions const&)::$_7>::_M_invoke(std::_Any_data const&, clang::CallExpr const*&&, clang::ast_matchers::MatchFinder::MatchResult const&, clang::dataflow::Environment const&) ()
#7 0x00000000030b1292 in std::_Function_handler<std::vector<clang::SourceLocation, std::allocator<clang::SourceLocation> > (clang::Stmt const*, clang::ast_matchers::MatchFinder::MatchResult const&, clang::dataflow::Environment const&), clang::dataflow::MatchSwitchBuilder<clang::dataflow::Environment const, std::vector<clang::SourceLocation, std::allocator<clang::SourceLocation> > >::CaseOf<clang::CallExpr>(clang::ast_matchers::internal::Matcher<clang::Stmt>, std::function<std::vector<clang::SourceLocation, std::allocator<clang::SourceLocation> > (clang::CallExpr const*, clang::ast_matchers::MatchFinder::MatchResult const&, clang::dataflow::Environment const&)>) &&::{lambda(clang::Stmt const*, clang::ast_matchers::MatchFinder::MatchResult const&, clang::dataflow::Environment const&)#1}>::_M_invoke(std::_Any_data const&, clang::Stmt const*&&, clang::ast_matchers::MatchFinder::MatchResult const&, clang::dataflow::Environment const&) ()
#8 0x00000000030b1995 in clang::dataflow::MatchSwitchBuilder<clang::dataflow::Environment const, std::vector<clang::SourceLocation, std::allocator<clang::SourceLocation> > >::Build() &&::{lambda(clang::Stmt const&, clang::ASTContext&, clang::dataflow::Environment const&)#1}::operator()(clang::Stmt const&, clang::ASTContext&, clang::dataflow::Environment const&) const ()
#9 0x00000000030b170c in std::_Function_handler<std::vector<clang::SourceLocation, std::allocator<clang::SourceLocation> > (clang::Stmt const&, clang::ASTContext&, clang::dataflow::Environment const&), clang::dataflow::MatchSwitchBuilder<clang::dataflow::Environment const, std::vector<clang::SourceLocation, std::allocator<clang::SourceLocation> > >::Build() &&::{lambda(clang::Stmt const&, clang::ASTContext&, clang::dataflow::Environment const&)#1}>::_M_invoke(std::_Any_data const&, clang::Stmt const&, clang::ASTContext&, clang::dataflow::Environment const&) ()
#10 0x00000000030a7c27 in clang::dataflow::UncheckedOptionalAccessDiagnoser::diagnose(clang::ASTContext&, clang::Stmt const*, clang::dataflow::Environment const&) ()
#11 0x0000000002931286 in std::_Function_handler<void (clang::Stmt const*, clang::dataflow::DataflowAnalysisState<clang::dataflow::NoopLattice> const&), clang::tidy::bugprone::analyzeFunction(clang::FunctionDecl const&, clang::ASTContext&)::$_0>::_M_invoke(std::_Any_data const&, clang::Stmt const*&&, clang::dataflow::DataflowAnalysisState<clang::dataflow::NoopLattice> const&) ()
#12 0x0000000002930b41 in clang::dataflow::runDataflowAnalysis<clang::dataflow::UncheckedOptionalAccessModel>(clang::dataflow::ControlFlowContext const&, clang::dataflow::UncheckedOptionalAccessModel&, clang::dataflow::Environment const&, std::function<void (clang::Stmt const*, clang::dataflow::DataflowAnalysisState<clang::dataflow::UncheckedOptionalAccessModel::Lattice> const&)>)::{lambda(clang::Stmt const*, clang::dataflow::TypeErasedDataflowAnalysisState const&)#1}::operator()(clang::Stmt const*, clang::dataflow::TypeErasedDataflowAnalysisState const&) const ()
#13 0x00000000030c18cc in std::_Function_handler<void (clang::CFGStmt const&, clang::dataflow::TypeErasedDataflowAnalysisState const&), clang::dataflow::runTypeErasedDataflowAnalysis(clang::dataflow::ControlFlowContext const&, clang::dataflow::TypeErasedDataflowAnalysis&, clang::dataflow::Environment const&, std::function<void (clang::Stmt const*, clang::dataflow::TypeErasedDataflowAnalysisState const&)>)::$_1>::_M_invoke(std::_Any_data const&, clang::CFGStmt const&, clang::dataflow::TypeErasedDataflowAnalysisState const&) ()
#14 0x00000000030bf069 in clang::dataflow::transferBlock(clang::dataflow::ControlFlowContext const&, std::vector<llvm::Optional<clang::dataflow::TypeErasedDataflowAnalysisState>, std::allocator<llvm::Optional<clang::dataflow::TypeErasedDataflowAnalysisState> > >&, clang::CFGBlock const&, clang::dataflow::Environment const&, clang::dataflow::TypeErasedDataflowAnalysis&, std::function<void (clang::CFGStmt const&, clang::dataflow::TypeErasedDataflowAnalysisState const&)>) ()
#15 0x00000000030bfaa5 in clang::dataflow::runTypeErasedDataflowAnalysis(clang::dataflow::ControlFlowContext const&, clang::dataflow::TypeErasedDataflowAnalysis&, clang::dataflow::Environment const&, std::function<void (clang::Stmt const*, clang::dataflow::TypeErasedDataflowAnalysisState const&)>) ()
#16 0x00000000029301b3 in llvm::Expected<std::vector<llvm::Optional<clang::dataflow::DataflowAnalysisState<clang::dataflow::UncheckedOptionalAccessModel::Lattice> >, std::allocator<llvm::Optional<clang::dataflow::DataflowAnalysisState<clang::dataflow::UncheckedOptionalAccessModel::Lattice> > > > > clang::dataflow::runDataflowAnalysis<clang::dataflow::UncheckedOptionalAccessModel>(clang::dataflow::ControlFlowContext const&, clang::dataflow::UncheckedOptionalAccessModel&, clang::dataflow::Environment const&, std::function<void (clang::Stmt const*, clang::dataflow::DataflowAnalysisState<clang::dataflow::UncheckedOptionalAccessModel::Lattice> const&)>) ()
#17 0x000000000292fbe8 in clang::tidy::bugprone::UncheckedOptionalAccessCheck::check(clang::ast_matchers::MatchFinder::MatchResult const&) ()
#18 0x00000000022e1572 in clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::MatchVisitor::visitMatch(clang::ast_matchers::BoundNodes const&) ()
#19 0x0000000002797a1c in clang::ast_matchers::internal::BoundNodesTreeBuilder::visitMatches(clang::ast_matchers::internal::BoundNodesTreeBuilder::Visitor*) ()
#20 0x00000000022e0dc6 in clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::matchWithFilter(clang::DynTypedNode const&) ()
#21 0x00000000022e3b57 in clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::TraverseDecl(clang::Decl*) ()
#22 0x00000000022e4c0c in clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseDecl(clang::Decl*) ()
#23 0x00000000022e3b62 in clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::TraverseDecl(clang::Decl*) ()
#24 0x00000000022e4c0c in clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseDecl(clang::Decl*) ()
#25 0x00000000022e3b62 in clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::TraverseDecl(clang::Decl*) ()
#26 0x00000000022e4c0c in clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseDecl(clang::Decl*) ()
#27 0x00000000022e3b62 in clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::TraverseDecl(clang::Decl*) ()
#28 0x00000000022e4c0c in clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseDecl(clang::Decl*) ()
#29 0x00000000022e3b62 in clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::TraverseDecl(clang::Decl*) ()
#30 0x00000000022e8791 in clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor>::TraverseDecl(clang::Decl*) ()
#31 0x00000000022e3b62 in clang::ast_matchers::internal::(anonymous namespace)::MatchASTVisitor::TraverseDecl(clang::Decl*) ()
#32 0x00000000022c017a in clang::ast_matchers::MatchFinder::matchAST(clang::ASTContext&) ()
#33 0x000000000370ad3c in clang::MultiplexConsumer::HandleTranslationUnit(clang::ASTContext&) ()
#34 0x00000000038ed4bb in clang::ParseAST(clang::Sema&, bool, bool) ()
#35 0x000000000369eda7 in clang::FrontendAction::Execute() ()
#36 0x000000000360d3f6 in clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) ()
#37 0x00000000027c475c in clang::tooling::FrontendActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) ()
#38 0x00000000022ad486 in clang::tidy::runClangTidy(clang::tidy::ClangTidyContext&, clang::tooling::CompilationDatabase const&, llvm::ArrayRef<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem>, bool, bool, llvm::StringRef)::ActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) ()
#39 0x00000000027c44c6 in clang::tooling::ToolInvocation::runInvocation(char const*, clang::driver::Compilation*, std::shared_ptr<clang::CompilerInvocation>, std::shared_ptr<clang::PCHContainerOperations>) ()
#40 0x00000000027c360b in clang::tooling::ToolInvocation::run() ()
#41 0x00000000027c5bb1 in clang::tooling::ClangTool::run(clang::tooling::ToolAction*) ()
#42 0x00000000022a90c7 in clang::tidy::runClangTidy(clang::tidy::ClangTidyContext&, clang::tooling::CompilationDatabase const&, llvm::ArrayRef<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem>, bool, bool, llvm::StringRef) ()
#43 0x0000000001ebc7f2 in clang::tidy::clangTidyMain(int, char const**) ()
#44 0x0000000004c54ba0 in __libc_start_main ()
#45 0x0000000001eb76ae in _start ()
```
Another note is that clang-tidy is CPU-bound. So we could consider running lintrunner job on 4xlarge if needed.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/115124
Approved by: https://github.com/kit1980, https://github.com/Skylion007, https://github.com/malfet
2023-12-05 16:27:56 +00:00
|
|
|
# can be found at https://github.com/llvm/llvm-project/issues/69369.
|
2025-01-10 03:16:56 +00:00
|
|
|
# When that happens, we can disable it on the problematic code by NOLINT.
|
2020-10-21 21:04:26 +00:00
|
|
|
InheritParentConfig: true
|
|
|
|
|
Checks: '
|
2019-10-28 16:51:02 +00:00
|
|
|
bugprone-*,
|
2023-02-01 14:44:13 +00:00
|
|
|
-bugprone-easily-swappable-parameters,
|
2019-10-28 16:51:02 +00:00
|
|
|
-bugprone-forward-declaration-namespace,
|
|
|
|
|
-bugprone-macro-parentheses,
|
|
|
|
|
-bugprone-lambda-function-name,
|
2021-04-01 16:03:13 +00:00
|
|
|
-bugprone-reserved-identifier,
|
2023-02-01 14:44:13 +00:00
|
|
|
-bugprone-swapped-arguments,
|
2025-01-06 15:44:45 +00:00
|
|
|
clang-analyzer-core.*,
|
|
|
|
|
clang-analyzer-cplusplus.*,
|
|
|
|
|
clang-analyzer-nullability.*,
|
|
|
|
|
clang-analyzer-deadcode.*,
|
2023-04-25 18:20:32 +00:00
|
|
|
clang-diagnostic-missing-prototypes,
|
2019-10-28 16:51:02 +00:00
|
|
|
cppcoreguidelines-*,
|
2023-02-01 14:44:13 +00:00
|
|
|
-cppcoreguidelines-avoid-do-while,
|
2021-05-08 02:59:13 +00:00
|
|
|
-cppcoreguidelines-avoid-magic-numbers,
|
2021-07-29 16:29:01 +00:00
|
|
|
-cppcoreguidelines-avoid-non-const-global-variables,
|
2019-10-28 16:51:02 +00:00
|
|
|
-cppcoreguidelines-interfaces-global-init,
|
2021-04-01 16:03:13 +00:00
|
|
|
-cppcoreguidelines-macro-usage,
|
2019-10-28 16:51:02 +00:00
|
|
|
-cppcoreguidelines-owning-memory,
|
|
|
|
|
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
|
|
|
|
|
-cppcoreguidelines-pro-bounds-constant-array-index,
|
|
|
|
|
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
|
|
|
|
|
-cppcoreguidelines-pro-type-cstyle-cast,
|
|
|
|
|
-cppcoreguidelines-pro-type-reinterpret-cast,
|
|
|
|
|
-cppcoreguidelines-pro-type-static-cast-downcast,
|
|
|
|
|
-cppcoreguidelines-pro-type-union-access,
|
|
|
|
|
-cppcoreguidelines-pro-type-vararg,
|
2021-07-29 16:29:01 +00:00
|
|
|
-cppcoreguidelines-non-private-member-variables-in-classes,
|
2020-10-21 21:04:26 +00:00
|
|
|
-facebook-hte-RelativeInclude,
|
2019-10-28 16:51:02 +00:00
|
|
|
hicpp-exception-baseclass,
|
|
|
|
|
hicpp-avoid-goto,
|
2023-09-30 10:39:52 +00:00
|
|
|
misc-*,
|
2024-11-04 23:57:39 +00:00
|
|
|
-misc-confusable-identifiers,
|
2023-09-30 10:39:52 +00:00
|
|
|
-misc-const-correctness,
|
2024-03-28 10:10:43 +00:00
|
|
|
-misc-include-cleaner,
|
2023-09-30 10:39:52 +00:00
|
|
|
-misc-use-anonymous-namespace,
|
|
|
|
|
-misc-unused-parameters,
|
|
|
|
|
-misc-no-recursion,
|
|
|
|
|
-misc-non-private-member-variables-in-classes,
|
2024-11-04 23:57:39 +00:00
|
|
|
-misc-unused-using-decls,
|
2019-10-28 16:51:02 +00:00
|
|
|
modernize-*,
|
2023-02-01 14:44:13 +00:00
|
|
|
-modernize-macro-to-enum,
|
2019-10-28 16:51:02 +00:00
|
|
|
-modernize-return-braced-init-list,
|
|
|
|
|
-modernize-use-auto,
|
|
|
|
|
-modernize-use-default-member-init,
|
|
|
|
|
-modernize-use-using,
|
2020-05-06 00:38:28 +00:00
|
|
|
-modernize-use-trailing-return-type,
|
2021-11-15 20:04:11 +00:00
|
|
|
-modernize-use-nodiscard,
|
2019-10-28 16:51:02 +00:00
|
|
|
performance-*,
|
2023-01-29 23:28:19 +00:00
|
|
|
readability-container-size-empty,
|
2023-12-19 21:08:33 +00:00
|
|
|
readability-delete-null-pointer,
|
2023-12-21 14:58:09 +00:00
|
|
|
readability-duplicate-include
|
2023-12-21 15:09:10 +00:00
|
|
|
readability-misplaced-array-index,
|
2024-12-30 14:49:33 +00:00
|
|
|
readability-redundant*
|
2023-12-27 20:22:20 +00:00
|
|
|
readability-simplify-subscript-expr,
|
2023-12-18 16:13:00 +00:00
|
|
|
readability-string-compare,
|
2024-12-30 14:49:33 +00:00
|
|
|
-readability-redundant-access-specifiers,
|
|
|
|
|
-readability-redundant-control-flow,
|
2020-10-21 21:04:26 +00:00
|
|
|
'
|
2023-10-04 13:52:06 +00:00
|
|
|
HeaderFilterRegex: '^(aten/|c10/|torch/).*$'
|
2021-07-29 16:29:01 +00:00
|
|
|
WarningsAsErrors: '*'
|
2024-06-10 23:49:58 +00:00
|
|
|
CheckOptions:
|
2024-11-06 13:42:20 +00:00
|
|
|
cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor: true
|
|
|
|
|
cppcoreguidelines-special-member-functions.AllowImplicitlyDeletedCopyOrMove: true
|
2024-11-05 16:00:25 +00:00
|
|
|
misc-header-include-cycle.IgnoredFilesList: 'format.h;ivalue.h;custom_class.h;Dict.h;List.h;IListRef.h'
|
2018-05-09 17:08:53 +00:00
|
|
|
...
|