diff options
author | bloodstalker <thabogre@gmail.com> | 2017-05-09 00:02:13 +0000 |
---|---|---|
committer | bloodstalker <thabogre@gmail.com> | 2017-05-09 00:02:13 +0000 |
commit | 213e539e1eedca8e66c93e56f13a3f6b1f9ce8b7 (patch) | |
tree | d2dcb0fe99f82bb97fde55ded3811bfc47070449 /bruiser | |
parent | now the list command works (diff) | |
download | mutator-213e539e1eedca8e66c93e56f13a3f6b1f9ce8b7.tar.gz mutator-213e539e1eedca8e66c93e56f13a3f6b1f9ce8b7.zip |
now prints function signature and var decls instead of just a name
Diffstat (limited to 'bruiser')
-rw-r--r-- | bruiser/bruiser.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/bruiser/bruiser.cpp b/bruiser/bruiser.cpp index 6ad30b7..dcc5eec 100644 --- a/bruiser/bruiser.cpp +++ b/bruiser/bruiser.cpp @@ -288,7 +288,21 @@ class LiveListFuncs : public MatchFinder::MatchCallback { const clang::FunctionDecl* FD = MR.Nodes.getNodeAs<clang::FunctionDecl>("livelistfuncs"); - PRINT_WITH_COLOR_LB(CYAN, FD->getNameAsString()); + if (FD->hasBody()) + { + Stmt* Body = FD->getBody(); + SourceLocation SLBody = Body->getLocStart(); + SourceLocation SLShebang = FD->getLocStart(); + PRINT_WITH_COLOR_LB(GREEN, "begin"); + PRINT_WITH_COLOR_LB(CYAN, R.getRewrittenText(clang::SourceRange(SLShebang, SLBody.getLocWithOffset(-1)))); + PRINT_WITH_COLOR_LB(GREEN, "end"); + } + else + { + SourceLocation SL = FD->getLocStart(); + SourceLocation SLE = FD->getLocEnd(); + PRINT_WITH_COLOR_LB(CYAN, R.getRewrittenText(clang::SourceRange(SL, SLE))); + } } } @@ -307,7 +321,7 @@ class LiveListVars : public MatchFinder::MatchCallback { const clang::VarDecl* VD = MR.Nodes.getNodeAs<clang::VarDecl>("livelistvars"); - PRINT_WITH_COLOR_LB(CYAN, VD->getNameAsString()); + PRINT_WITH_COLOR_LB(CYAN, R.getRewrittenText(SourceRange(VD->getLocStart(), VD->getLocEnd()))); } } |