Skip to content

Commit

Permalink
[Clang Tidy] Fix misc-header-include-cycle errors in clang-tidy and i…
Browse files Browse the repository at this point in the history
…gnore some files (pytorch#127233)

Since there are such cycles in libfmt and PyTorch, which are detected by clang-tidy.
```
/home/cyy/pytorch/third_party/fmt/include/fmt/format-inl.h:25:10: error: circular header file dependency detected while including 'format.h', please check the include path [misc-header-include-cycle,-warnings-as-errors]
   25 | #include "format.h"
      |          ^
/home/cyy/pytorch/third_party/fmt/include/fmt/format.h:4530:12: note: 'format-inl.h' included from here
 4530 | #  include "format-inl.h"
```
Pull Request resolved: pytorch#127233
Approved by: https://github.com/ezyang
  • Loading branch information
cyyever authored and pytorchmergebot committed Jun 10, 2024
1 parent f843ccb commit 99f5a85
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,6 @@ readability-string-compare,
'
HeaderFilterRegex: '^(aten/|c10/|torch/).*$'
WarningsAsErrors: '*'
CheckOptions:
misc-header-include-cycle.IgnoredFilesList: 'format.h;ivalue.h;custom_class.h;Dict.h;List.h'
...
1 change: 1 addition & 0 deletions torch/csrc/jit/python/python_custom_class.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <torch/csrc/jit/python/pybind_utils.h>
#include <torch/csrc/jit/python/python_custom_class.h>

#include <torch/csrc/jit/frontend/sugared_value.h>
Expand Down
1 change: 0 additions & 1 deletion torch/csrc/jit/python/python_custom_class.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once

#include <torch/csrc/jit/python/pybind_utils.h>
#include <torch/csrc/utils/pybind.h>
#include <torch/custom_class.h>

Expand Down

0 comments on commit 99f5a85

Please sign in to comment.