commit f313fe8f434dee394f2e11625c591f2adb578a4b
parent f185b0d828daa153f7144e012a6946ba2d2296ad
Author: Kyle Milz <kyle@0x30.net>
Date: Thu, 11 Aug 2016 18:59:13 -0600
src: dont traverse global variables or enums
Diffstat:
6 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/src/inst_visitor.cc b/src/inst_visitor.cc
@@ -39,6 +39,14 @@ RewriteASTVisitor::TraverseDecl(clang::Decl *d)
if (m_SM.isInMainFile(d->getLocStart()) == false)
return false;
+ if (clang::isa<clang::VarDecl>(d)) {
+ clang::VarDecl *vd = clang::cast<clang::VarDecl>(d);
+ if (vd->hasGlobalStorage())
+ return false;
+ }
+ if (clang::isa<clang::EnumDecl>(d))
+ return false;
+
RecursiveASTVisitor<RewriteASTVisitor>::TraverseDecl(d);
return true;
}
diff --git a/tt/ccitrunrun.t b/tt/ccitrunrun.t
@@ -85,7 +85,7 @@ Totals:
4 Switch statements
99 Return statement values
1248 Call expressions
- 22349 Total statements
+ 22343 Total statements
184 Errors rewriting source
EOF
diff --git a/tt/git.t b/tt/git.t
@@ -315,7 +315,7 @@ Totals:
294 Switch statements
7664 Return statement values
36340 Call expressions
- 904248 Total statements
+ 839628 Total statements
7375 Errors rewriting source
EOF
diff --git a/tt/mutt.t b/tt/mutt.t
@@ -146,7 +146,7 @@ Totals:
147 Switch statements
2715 Return statement values
11739 Call expressions
- 376507 Total statements
+ 358282 Total statements
5826 Errors rewriting source
EOF
diff --git a/tt/nvi.t b/tt/nvi.t
@@ -158,7 +158,7 @@ Totals:
161 Switch statements
1728 Return statement values
3476 Call expressions
- 215219 Total statements
+ 196364 Total statements
3118 Errors rewriting source
EOF
diff --git a/tt/openssl.t b/tt/openssl.t
@@ -728,7 +728,7 @@ Totals:
333 Switch statements
10646 Return statement values
30962 Call expressions
- 1770286 Total statements
+ 1021053 Total statements
16352 Errors rewriting source
EOF