Skip to content

decodable/called_if

Repository files navigation

called_if

To find out whether a function is called in conditional.

We have some functions, which have special requirements, that they cannot be called in conditional. For example, bar is called depends on the value of variable cond. So we need to find out such functions like bar.

void foo(bool cond) {
  if (cond) {
    bar();
  }
}

libclang

One implementation uses libclang, which is the C Interface to Clang.

To build:

git clone git@github.com:decodable/called_if.git
cd called_if/lib-clang
mkdir build
cd build
cmake ..
make

LibTooling

One implementation as a clang tool.

To build:

git clone git@github.com:decodable/called_if.git
cd called_if/clang-tools/called_if
docker build .

Docker

Compiled and tested in the docker clang_dev.

References

  1. Clang 8 - Choosing the Right Interface for Your Application
  2. Baby steps with libclang: Walking an abstract syntax tree
  3. How to write RecursiveASTVisitor based ASTFrontendActions.

About

whether a function is called in conditional

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published