aboutsummaryrefslogtreecommitdiffstats
path: root/bruiser/bruiser.cpp
diff options
context:
space:
mode:
authorbloodstalker <thabogre@gmail.com>2017-05-09 00:02:13 +0000
committerbloodstalker <thabogre@gmail.com>2017-05-09 00:02:13 +0000
commit213e539e1eedca8e66c93e56f13a3f6b1f9ce8b7 (patch)
treed2dcb0fe99f82bb97fde55ded3811bfc47070449 /bruiser/bruiser.cpp
parentnow the list command works (diff)
downloadmutator-213e539e1eedca8e66c93e56f13a3f6b1f9ce8b7.tar.gz
mutator-213e539e1eedca8e66c93e56f13a3f6b1f9ce8b7.zip
now prints function signature and var decls instead of just a name
Diffstat (limited to 'bruiser/bruiser.cpp')
-rw-r--r--bruiser/bruiser.cpp18
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())));
}
}