diff options
Diffstat (limited to 'bruiser/bruiser.cpp')
-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()))); } } |