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

The test results are different when installing clang-query-10 using apt and pip for the project. #102

Open
tomchon opened this issue Aug 12, 2024 · 1 comment

Comments

@tomchon
Copy link

tomchon commented Aug 12, 2024

i want using clang-query to do Static Code Analysis. but i find some different and funny things. The test results are different when installing clang-query-10 using apt and pip method in the project. The only difference is the path used for clang-query.

  1. using pip install
    It will install the clang-tools into /usr/local/bin/
pip3 install clang-tools 
clang-tools --install 10 --tool  clang-query   --directory  /usr/local/bin/

test result in match :

 root@dc9a644c9793: /usr/local/bin/clang-query-10 TDengine/debug/compile_commands.json TDengine/community/source/dnode/vnode/src/tsdb/tsdbRead2.c -f TDengine/community/tests/ci/filter_for_return_values 

0 matches.
  1. apt install
    It will install the clang-tools into /usr/bin/
apt install clang-tools-10
root@dc9a644c9793:/home/chr/clang_scan_result/20240812154233#  /usr/bin/clang-query-10 -p TDengine/debug/compile_commands.json TDengine/community/source/dnode/vnode/src/tsdb/tsdbRead2.c -f TDengine/community/tests/ci/filter_for_return_values
In file included from TDengine/community/source/dnode/vnode/src/tsdb/tsdbRead2.c:17:
In file included from TDengine/community/source/dnode/vnode/src/inc/tsdb.h:22:
In file included from TDengine/community/include/util/tsimplehash.h:19:
In file included from TDengine/community/include/util/tarray.h:19:

Match #1:
TDengine/community/source/dnode/vnode/src/tsdb/tsdbRead2.c:5831:7: note: "root" binds here
      tsdbUnrefMemTable(pTsdb->mem, pSnap->pNode, true);  // unref the previous refed mem
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Match #2:

TDengine/community/source/dnode/vnode/src/tsdb/tsdbRead2.c:5848:7: note: "root" binds here
      tsdbUnrefMemTable(pTsdb->mem, pSnap->pNode, true);  // unref the previous refed mem
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Match #3:
TDengine/source/dnode/vnode/src/tsdb/tsdbRead2.c:5852:7: note: "root" binds here
      tsdbUnrefMemTable(pTsdb->imem, pSnap->pINode, true);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 matches.
@shenxianpeng
Copy link
Collaborator

shenxianpeng commented Aug 12, 2024

Thanks for reporting this issue. I am not sure if it is because of clang-query-10 versions are different.

The clang-query-10 version supported by clang-tools is 10.0.1, but the version installed with apt install clang-tools-10 should be 10.0.0.

If you run the apt install clang-tools-10 first and then run clang-tools --install 10 --tool clang-query, clang-tools will link to /usr/lib/llvm-10/bin/clang-query automatically.

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

2 participants