File | Mode | Size |
---|---|---|
src/ | 040000 | |
tests/ | 040000 | |
CMakeLists.txt | 100644 | 353B |
LICENSE | 100644 | 18KiB |
README.md | 100644 | 1,034B |
Clang-based standalone tool that diagnoses the following cases of defining functions:
extern
;extern
which are used only locally and thus can be
made static
.Input:
static void firstStatic(void);
static void secondStatic(void);
void firstExtern(void);
extern void secondExtern(void);
static void firstStatic(void) { }
static void secondStatic(void) { }
void firstExtern(void) { }
void secondExtern(void) { }
int
main(void)
{
firstExtern();
secondStatic();
return 0;
}
Run command:
bin/unused-funcs main.c --
Output (paths are truncated):
.../main.c:20:firstExtern:can be made static
.../main.c:25:secondExtern:unused
llvm/tools/clang/tools/extra
.add_subdirectory(unused-funcs)
to CMakeLists.txt
in the same
directory.ninja unused-funcs
inside your LLVM's build/
directory.