From 213e539e1eedca8e66c93e56f13a3f6b1f9ce8b7 Mon Sep 17 00:00:00 2001 From: bloodstalker Date: Tue, 9 May 2017 04:32:13 +0430 Subject: now prints function signature and var decls instead of just a name --- bruiser/bruiser.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'bruiser/bruiser.cpp') 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("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("livelistvars"); - PRINT_WITH_COLOR_LB(CYAN, VD->getNameAsString()); + PRINT_WITH_COLOR_LB(CYAN, R.getRewrittenText(SourceRange(VD->getLocStart(), VD->getLocEnd()))); } } -- cgit v1.2.3