GithubHelp home page GithubHelp logo

doytsujin / xunused Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mgehre/xunused

0.0 1.0 0.0 30 KB

xunused is a tool to find unused C/C++ functions and methods across source files in the whole project.

License: Apache License 2.0

CMake 9.13% C++ 90.87%

xunused's Introduction

xunused

xunused is a tool to find unused C/C++ functions and methods across source files in the whole project. It is built upon clang to parse the source code (in parallel). It then shows all functions that had a definition but no use. Templates, virtual functions, constructors, functions with static linkage are all taken into account. If you find an issue, please open a issue on https://github.com/mgehre/xunused or file a pull request.

xunused is compatible with LLVM and Clang versions 10 and 11.

Building and Installation

First download or build the necessary versions of LLVM and Clang with development headers. On Debian and Ubuntu, this can easily be done via http://apt.llvm.org/ and apt install llvm-10-dev libclang-10-dev. Then build via

mkdir build
cd build
cmake ..
make

Run it

To run the tool, provide a compilation database. By default, it will analyze all files that are mentioned in it.

cd build
./xunused /path/to/your/project/compile_commands.json

You can specify the option -filter together with a regular expressions. Only files who's path is matching the regular expression will be analyzed. You might want to exclude your test's source code to find functions that are only used by tests but not any other code.

If xunused complains about missing include files such as stddef.h, try adding -extra-arg=-I/usr/include/clang/10/include (or similar) to the arguments.

xunused's People

Contributors

mgehre avatar hummer12007 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.