Skip to content

Commit

Permalink
Fix up clang-format header config for cinderx move
Browse files Browse the repository at this point in the history
Summary:
Update our clang-format rules to try and keep things about as they
were before all of our internal includes were relative to `cinderx/`. I decided
on a formal separation between third-party code in `cinderx/ThirdParty` and
elsewhere, but other than that the only changes here should be when a
`cinderx/` prefix affected the sort order within a category.

Reviewed By: alexmalyshev

Differential Revision: D52808612

fbshipit-source-id: 982f654f86740e77f367d31d19373261494bfa51
  • Loading branch information
swtaarrs authored and facebook-github-bot committed Jan 16, 2024
1 parent c4f1666 commit 9ababf5
Show file tree
Hide file tree
Showing 24 changed files with 46 additions and 33 deletions.
16 changes: 11 additions & 5 deletions cinderx/.cpp-clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,22 @@ IncludeBlocks: Regroup
IncludeCategories:
- Regex: '<gtest/.*>'
Priority: 1
- Regex: '"Jit/.*"'
- Regex: '"cinderx/Jit/.*"'
Priority: 3
- Regex: '"RuntimeTests/.*"'
- Regex: '"cinderx/RuntimeTests/.*"'
Priority: 4
- Regex: '".*"'
# Third-party headers that we've vendored in are grouped right before other
# third-party code.
- Regex: '"cinderx/ThirdParty/.*"'
Priority: 5
# Any other paths in cinderx/ are assumed to be files that used to be in
# upstream directories, so we group their includes with upstream files.
- Regex: '"(cinderx/)?.*"'
Priority: 2
- Regex: '^<.*\.h(pp)?>'
Priority: 5
- Regex: '^<.*'
Priority: 6
- Regex: '^<.*'
Priority: 7
IndentCaseLabels: true
IndentWidth: 2
IndentWrappedFunctionNames: false
Expand Down
2 changes: 1 addition & 1 deletion cinderx/Jit/bytecode.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#pragma once

#include "cinderx/Interpreter/opcode.h"
#include "Python.h"
#include "cinderx/Interpreter/opcode.h"

#include "cinderx/Jit/bytecode_offsets.h"
#include "cinderx/Jit/log.h"
Expand Down
4 changes: 2 additions & 2 deletions cinderx/Jit/code_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

#pragma once

#include "cinderx/ThirdParty/asmjit/src/asmjit/asmjit.h"

#include "cinderx/Jit/codegen/code_section.h"
#include "cinderx/Jit/log.h"

#include "cinderx/ThirdParty/asmjit/src/asmjit/asmjit.h"

#include <memory>
#include <vector>

Expand Down
2 changes: 1 addition & 1 deletion cinderx/Jit/codegen/gen_asm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#include "cinderx/Jit/codegen/gen_asm.h"

#include "Python.h"
#include "cinderx/StaticPython/classloader.h"
#include "cinder/exports.h"
#include "cinderx/StaticPython/classloader.h"
#include "frameobject.h"
#include "internal/pycore_pystate.h"
#include "internal/pycore_shadow_frame.h"
Expand Down
2 changes: 1 addition & 1 deletion cinderx/Jit/codegen/gen_asm.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#pragma once

#include "cinderx/Interpreter/opcode.h"
#include "Python.h"
#include "cinderx/Interpreter/opcode.h"

#include "cinderx/Jit/bitvector.h"
#include "cinderx/Jit/codegen/environ.h"
Expand Down
3 changes: 2 additions & 1 deletion cinderx/Jit/frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
#include "Python.h"
#include "cinder/exports.h"
#include "cinder/genobject_jit.h"
#include "cinderx/Jit/bytecode_offsets.h"
#include "internal/pycore_pystate.h"
#include "internal/pycore_shadow_frame.h"
#include "pycore_object.h"

#include "cinderx/Jit/bytecode_offsets.h"
#include "cinderx/Jit/debug_info.h"
#include "cinderx/Jit/log.h"
#include "cinderx/Jit/runtime.h"
Expand Down
6 changes: 3 additions & 3 deletions cinderx/Jit/hir/builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

#include "cinderx/Jit/hir/builder.h"

#include "cinderx/Interpreter/opcode.h"
#include "Python.h"
#include "cinderx/StaticPython/checked_dict.h"
#include "cinderx/StaticPython/checked_list.h"
#include "boolobject.h"
#include "ceval.h"
#include "cinderx/Interpreter/opcode.h"
#include "cinderx/StaticPython/checked_dict.h"
#include "cinderx/StaticPython/checked_list.h"
#include "object.h"
#include "preload.h"
#include "structmember.h"
Expand Down
2 changes: 1 addition & 1 deletion cinderx/Jit/hir/hir.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#pragma once

#include "cinderx/Interpreter/opcode.h"
#include "Python.h"
#include "cinderx/Interpreter/opcode.h"
#include "code.h"

#include "cinderx/Jit/bytecode.h"
Expand Down
2 changes: 1 addition & 1 deletion cinderx/Jit/hir/preload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#include "cinderx/Jit/hir/preload.h"

#include "cinderx/Interpreter/opcode.h"
#include "Python.h"
#include "cinderx/Interpreter/opcode.h"

#include "cinderx/Jit/bytecode.h"
#include "cinderx/Jit/codegen/gen_asm.h"
Expand Down
3 changes: 2 additions & 1 deletion cinderx/Jit/hir/printer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
#include "cinderx/Jit/runtime.h"
#include "cinderx/Jit/util.h"

#include "cinderx/ThirdParty/json/json.hpp"

#include <fmt/format.h>
#include <fmt/ostream.h>
#include "cinderx/ThirdParty/json/json.hpp"

#include <algorithm>
#include <fstream>
Expand Down
2 changes: 1 addition & 1 deletion cinderx/Jit/inline_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

#include "cinderx/Jit/inline_cache.h"

#include "cinderx/Common/watchers.h"
#include "Objects/dict-common.h"
#include "Python.h"
#include "cinderx/Common/watchers.h"
#include "cinderx/StaticPython/strictmoduleobject.h"

#include "cinderx/Jit/codegen/gen_asm.h"
Expand Down
2 changes: 1 addition & 1 deletion cinderx/Jit/jit_rt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

#include "Objects/dict-common.h"
#include "Python.h"
#include "cinderx/StaticPython/classloader.h"
#include "cinder/exports.h"
#include "cinderx/StaticPython/classloader.h"
#include "frameobject.h"
#include "listobject.h"
#include "object.h"
Expand Down
3 changes: 2 additions & 1 deletion cinderx/Jit/jit_time_log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

#include "cinderx/Jit/log.h"

#include <fmt/format.h>
#include "cinderx/ThirdParty/parallel-hashmap/parallel_hashmap/phmap.h"

#include <fmt/format.h>

#include <iostream>
#include <memory>
#include <sstream>
Expand Down
4 changes: 2 additions & 2 deletions cinderx/Jit/lir/generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

#include "cinderx/Jit/lir/generator.h"

#include "cinderx/Interpreter/interpreter.h"
#include "Python.h"
#include "cinder/exports.h"
#include "cinderx/Interpreter/interpreter.h"
#include "cinderx/StaticPython/checked_dict.h"
#include "cinderx/StaticPython/checked_list.h"
#include "cinder/exports.h"
#include "internal/pycore_import.h"
#include "internal/pycore_interp.h"
#include "internal/pycore_pyerrors.h"
Expand Down
2 changes: 1 addition & 1 deletion cinderx/Jit/profile_runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

#include "cinderx/Jit/profile_runtime.h"

#include "cinderx/Interpreter/opcode.h"
#include "Objects/dict-common.h"
#include "Python.h"
#include "cinderx/Interpreter/opcode.h"
#include "frameobject.h"

#include "cinderx/Jit/hir/type.h"
Expand Down
10 changes: 6 additions & 4 deletions cinderx/Jit/pyjit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
#include "Python.h"
#include "cinder/exports.h"
#include "cinder/genobject_jit.h"
#include "cinderx/StrictModules/pystrictmodule.h"
#include "internal/pycore_ceval.h"
#include "internal/pycore_shadow_frame.h"
#include "pycore_interp.h"

#include "cinderx/Jit/code_allocator.h"
#include "cinderx/Jit/codegen/gen_asm.h"
#include "cinderx/Jit/config.h"
Expand All @@ -24,13 +29,10 @@
#include "cinderx/Jit/profile_runtime.h"
#include "cinderx/Jit/ref.h"
#include "cinderx/Jit/runtime.h"
#include "internal/pycore_ceval.h"
#include "internal/pycore_shadow_frame.h"
#include "pycore_interp.h"
#include "cinderx/Jit/strobelight_exports.h"
#include "cinderx/Jit/type_profiler.h"
#include "cinderx/Jit/util.h"
#include "cinderx/StrictModules/pystrictmodule.h"

#include "cinderx/ThirdParty/i386-dis/dis-asm.h"

#include <atomic>
Expand Down
1 change: 1 addition & 0 deletions cinderx/Jit/runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "Python.h"
#include "cinder/genobject_jit.h"

#include "cinderx/Jit/containers.h"
#include "cinderx/Jit/debug_info.h"
#include "cinderx/Jit/deopt.h"
Expand Down
2 changes: 1 addition & 1 deletion cinderx/RuntimeTests/bytecode_test.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com)
#include <gtest/gtest.h>

#include "cinderx/Interpreter/opcode.h"
#include "Python.h"
#include "cinderx/Interpreter/opcode.h"

#include "cinderx/Jit/bytecode.h"

Expand Down
1 change: 1 addition & 0 deletions cinderx/RuntimeTests/cmdline_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "cinderx/RuntimeTests/testutil.h"

#include "cinderx/ThirdParty/i386-dis/dis-asm.h"

#include <fmt/format.h>

#include <cstdlib>
Expand Down
2 changes: 1 addition & 1 deletion cinderx/RuntimeTests/deopt_test.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com)
#include <gtest/gtest.h>

#include "cinderx/Interpreter/opcode.h"
#include "Python.h"
#include "cinderx/Interpreter/opcode.h"

#include "cinderx/Jit/codegen/gen_asm.h"
#include "cinderx/Jit/codegen/x86_64.h"
Expand Down
2 changes: 1 addition & 1 deletion cinderx/RuntimeTests/hir_frame_state_test.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com)
#include <gtest/gtest.h>

#include "cinderx/Interpreter/opcode.h"
#include "Python.h"
#include "cinderx/Interpreter/opcode.h"

#include "cinderx/Jit/hir/builder.h"
#include "cinderx/Jit/hir/hir.h"
Expand Down
2 changes: 1 addition & 1 deletion cinderx/RuntimeTests/hir_operand_type_test.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com)
#include <gtest/gtest.h>

#include "cinderx/Interpreter/opcode.h"
#include "Python.h"
#include "cinderx/Interpreter/opcode.h"

#include "cinderx/Jit/hir/analysis.h"
#include "cinderx/Jit/hir/hir.h"
Expand Down
2 changes: 1 addition & 1 deletion cinderx/RuntimeTests/hir_test.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com)
#include <gtest/gtest.h>

#include "cinderx/Interpreter/opcode.h"
#include "Python.h"
#include "cinderx/Interpreter/opcode.h"

#include "cinderx/Jit/compiler.h"
#include "cinderx/Jit/hir/builder.h"
Expand Down
2 changes: 1 addition & 1 deletion cinderx/RuntimeTests/inline_cache_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#include <gtest/gtest.h>

#include "Python.h"
#include "cinderx/StrictModules/Objects/objects.h"
#include "cinder/exports.h"
#include "cinderx/StrictModules/Objects/objects.h"
#include "unicodeobject.h"

#include "cinderx/Jit/inline_cache.h"
Expand Down

0 comments on commit 9ababf5

Please sign in to comment.