Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iwyu #85

Open
maflcko opened this issue May 12, 2023 · 0 comments
Open

iwyu #85

maflcko opened this issue May 12, 2023 · 0 comments

Comments

@maflcko
Copy link
Owner

maflcko commented May 12, 2023

dnf

dnf install bear llvm-devel clang-devel gcc-c++ libtool make autoconf automake python3 clang llvm lbzip2 patch xz cmake     curl wget htop git vim ccache libevent-devel boost-devel qt5-qttools-devel qt5-qtbase-devel sqlite-devel zeromq-devel  -y && git clone https://github.com/bitcoin/bitcoin.git  --depth=1 ./b-c && cd b-c && ./autogen.sh
git clone --depth=1 https://github.com/include-what-you-use/include-what-you-use -b clang_18 /include-what-you-use
cmake -B /build_iwyu/ -G 'Unix Makefiles' -S /include-what-you-use  -DCMAKE_PREFIX_PATH=/usr/lib/clang/18  # ?
make -C /build_iwyu/ install -j $(nproc)


cmake -B bld-cmake  -DWITH_ZMQ=ON -DBUILD_BENCH=ON -DWITH_ZMQ=ON      -DCMAKE_CXX_COMPILER='clang++;-I/usr/lib/clang/18/include'  -DCMAKE_EXPORT_COMPILE_COMMANDS=ON

./configure CC=clang CXX=clang++ CXXFLAGS='-I/usr/lib/clang/18/include' &&  make clean && bear --config src/.bear-tidy-config -- make -j $(nproc)


python3 "/include-what-you-use/iwyu_tool.py" -p ./bld-cmake -j 9 -- -Xiwyu --cxx17ns -Xiwyu --mapping_file="$PWD/contrib/devtools/iwyu/bitcoin.core.imp"  2>&1 | tee /tmp/iwyu_ci.out

python3 "/include-what-you-use/iwyu_tool.py" -p . -j 9 -- -Xiwyu --cxx17ns -Xiwyu --mapping_file="$PWD/contrib/devtools/iwyu/bitcoin.core.imp"  2>&1 | tee /tmp/iwyu_ci.out


echo 'aW1wb3J0IHN1YnByb2Nlc3MKaW1wb3J0IGFyZ3BhcnNlCiAgICAgICAgCgpkZW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IGlmIGFyZ3Mu
YndkIGVsc2UgIAogICAgICAgICAgICAgICAgICAgICAgICBmJ3M6PHtofT46IntofSI6ZycgICAg
ICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgIF0pCiAgICBzZWRfY21kLmV4dGVuZChzcmNf
ZmlsZXMpCiAgICAKICAgIHByaW50KHNlZF9jbWQpCiAgICBzdWJwcm9jZXNzLnJ1bihzZWRfY21k
LCBjaGVjaz1UcnVlKQoKaWYgX19uYW1lX18gPT0gIl9fbWFpbl9fIjoKICAgIG1haW4oKQoK' | base64 --decode > /tmp/helper.py
python3 /tmp/helper.py
( cd src && python3 "/include-what-you-use/fix_includes.py" --reorder < /tmp/iwyu_ci.out )
python3 /tmp/helper.py --bwd

diff

diff --git a/fix_includes.py b/fix_includes.py
index 2b95d0e..5b98cb9 100755
--- a/fix_includes.py
+++ b/fix_includes.py
@@ -1538,10 +1538,10 @@ def _GetNamespaceLevelReorderSpans(file_lines):
 # These are potential 'kind' arguments to _FirstReorderSpanWith.
 # We also sort our output in this order, to the extent possible.
 _MAIN_CU_INCLUDE_KIND = 1         # e.g. #include "foo.h" when editing foo.cc
-_C_SYSTEM_INCLUDE_KIND = 2        # e.g. #include <stdio.h>
-_CXX_SYSTEM_INCLUDE_KIND = 3      # e.g. #include <vector>
-_NONSYSTEM_INCLUDE_KIND = 4       # e.g. #include "bar.h"
-_PROJECT_INCLUDE_KIND = 5         # e.g. #include "myproject/quux.h"
+_C_SYSTEM_INCLUDE_KIND = 4        # e.g. #include <stdio.h>
+_CXX_SYSTEM_INCLUDE_KIND = 5      # e.g. #include <vector>
+_NONSYSTEM_INCLUDE_KIND = 2       # e.g. #include "bar.h"
+_PROJECT_INCLUDE_KIND = 3         # e.g. #include "myproject/quux.h"
 _FORWARD_DECLARE_KIND = 6         # e.g. class Baz;
 _EOF_KIND = 7                     # used at eof
 

bwd

<assert.h>:<cassert>
<ctype.h>:<cctype>
<errno.h>:<cerrno>
<float.h>:<cfloat>
<limits.h>:<climits>
<locale.h>:<clocale>
<math.h>:<cmath>
<setjmp.h>:<csetjmp>
<signal.h>:<csignal>
<stdarg.h>:<cstdarg>
<stddef.h>:<cstddef>
<stdio.h>:<cstdio>
<stdlib.h>:<cstdlib>
<string.h>:<cstring>
<time.h>:<ctime>
<wchar.h>:<cwchar>
<wctype.h>:<cwctype>
<uchar.h>:<cuchar>
<inttypes.h>:<cinttypes>
<stdint.h>:<cstdint>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant