citrun

watch C/C++ source code execute
Log | Files | Refs | LICENSE

commit f185b0d828daa153f7144e012a6946ba2d2296ad
parent a1d702989d3074af1b28253e667084396e8fe741
Author: Kyle Milz <kyle@0x30.net>
Date:   Thu, 11 Aug 2016 18:41:07 -0600

src: only traverse declarations in main file

Diffstat:
Msrc/inst_visitor.cc | 10++++++++++
Msrc/inst_visitor.h | 1+
Mt/inst_correct.t | 2+-
Mt/inst_for.t | 2+-
Mt/inst_if.t | 2+-
Mt/inst_log.t | 2+-
Mt/inst_stdout.t | 2+-
Mtt/ccitrunrun.t | 2+-
Mtt/git.t | 18+++++++++---------
Mtt/mutt.t | 2+-
Mtt/nvi.t | 2+-
Mtt/openssl.t | 2+-
12 files changed, 29 insertions(+), 18 deletions(-)

diff --git a/src/inst_visitor.cc b/src/inst_visitor.cc @@ -34,6 +34,16 @@ RewriteASTVisitor::TraverseStmt(clang::Stmt *s) } bool +RewriteASTVisitor::TraverseDecl(clang::Decl *d) +{ + if (m_SM.isInMainFile(d->getLocStart()) == false) + return false; + + RecursiveASTVisitor<RewriteASTVisitor>::TraverseDecl(d); + return true; +} + +bool RewriteASTVisitor::VisitVarDecl(clang::VarDecl *d) { return true; diff --git a/src/inst_visitor.h b/src/inst_visitor.h @@ -40,6 +40,7 @@ public: {} virtual bool TraverseStmt(clang::Stmt *); + virtual bool TraverseDecl(clang::Decl *); bool VisitVarDecl(clang::VarDecl *d); bool VisitStmt(clang::Stmt *s); diff --git a/t/inst_correct.t b/t/inst_correct.t @@ -46,7 +46,7 @@ Totals: 25 Lines of source code 32 Lines of instrumentation header 1 Functions called 'main' - 5 Function definitions + 2 Function definitions 3 If statements 5 Return statement values 4 Call expressions diff --git a/t/inst_for.t b/t/inst_for.t @@ -43,7 +43,7 @@ Totals: 11 Lines of source code 32 Lines of instrumentation header 1 Functions called 'main' - 4 Function definitions + 1 Function definitions 1 For loops 15 Total statements EOF diff --git a/t/inst_if.t b/t/inst_if.t @@ -57,7 +57,7 @@ Totals: 18 Lines of source code 32 Lines of instrumentation header 1 Functions called 'main' - 4 Function definitions + 1 Function definitions 3 If statements 3 Return statement values 2 Call expressions diff --git a/t/inst_log.t b/t/inst_log.t @@ -55,7 +55,7 @@ Instrumentation of '' finished: 22 Lines of source code 32 Lines of instrumentation header 1 Functions called '' - 5 Function definitions + 2 Function definitions 2 If statements 4 Return statement values 4 Call expressions diff --git a/t/inst_stdout.t b/t/inst_stdout.t @@ -30,7 +30,7 @@ Totals: 9 Lines of source code 32 Lines of instrumentation header 1 Functions called 'main' - 5 Function definitions + 1 Function definitions 1 Return statement values 1 Call expressions 9 Total statements diff --git a/tt/ccitrunrun.t b/tt/ccitrunrun.t @@ -78,7 +78,7 @@ Totals: 5350 Lines of source code 736 Lines of instrumentation header 3 Functions called 'main' - 56064 Function definitions + 222 Function definitions 226 If statements 33 For loops 12 While loops diff --git a/tt/git.t b/tt/git.t @@ -307,16 +307,16 @@ Totals: 185689 Lines of source code 12192 Lines of instrumentation header 100 Functions called 'main' - 32539 Function definitions - 25154 If statements - 2061 For loops - 1442 While loops - 411 Do while loops + 6015 Function definitions + 18733 If statements + 1767 For loops + 1117 While loops + 81 Do while loops 294 Switch statements - 29334 Return statement values - 57537 Call expressions - 1539430 Total statements - 19674 Errors rewriting source + 7664 Return statement values + 36340 Call expressions + 904248 Total statements + 7375 Errors rewriting source EOF system("$ENV{CITRUN_TOOLS}/citrun-check /usr/ports/pobj/git-* > check.out"); diff --git a/tt/mutt.t b/tt/mutt.t @@ -138,7 +138,7 @@ Totals: 94664 Lines of source code 6976 Lines of instrumentation header 102 Functions called 'main' - 4199 Function definitions + 1711 Function definitions 7536 If statements 658 For loops 470 While loops diff --git a/tt/nvi.t b/tt/nvi.t @@ -150,7 +150,7 @@ Totals: 47830 Lines of source code 3680 Lines of instrumentation header 2 Functions called 'main' - 2102 Function definitions + 658 Function definitions 3255 If statements 347 For loops 58 While loops diff --git a/tt/openssl.t b/tt/openssl.t @@ -720,7 +720,7 @@ Totals: 322027 Lines of source code 24064 Lines of instrumentation header 43 Functions called 'main' - 10574 Function definitions + 6722 Function definitions 25118 If statements 1482 For loops 476 While loops