Skip to content

Python bindings for writing clang-based tools based on libtooling (e.g. for refactoring, auto-completion, etc.)

License

Notifications You must be signed in to change notification settings

firolino/python-clang-tooling

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

python-clang-tooling

from libtooling import *

def fn_finder_cb(nodes):
  if nodes.getFunctionDecl("0"):
    print("print function found")

def int_finder_cb(nodes):
  if nodes.getVarDecl("int"):
    print("integer found")

fn_finder1 = functionDecl(hasName("print")).bind("0")
int_finder = varDecl(hasType(isInteger())).bind("int")

tooling = Tooling("../tests/simple.cc")

tooling.add(fn_finder1, fn_finder_cb)
tooling.add(int_finder, int_finder_cb)

tooling.run()

About

Python bindings for writing clang-based tools based on libtooling (e.g. for refactoring, auto-completion, etc.)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published