Skip to content

Commit

Permalink
be less verbose on debug messages
Browse files Browse the repository at this point in the history
  • Loading branch information
rizsotto committed Oct 10, 2012
1 parent a5e8555 commit 0d20073
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion sources/ScopeAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include <boost/bind.hpp>
#include <boost/range.hpp>
#include <boost/range/adaptor/filtered.hpp>
#include <boost/range/algorithm/for_each.hpp>

#include <clang/AST/RecursiveASTVisitor.h>
Expand Down Expand Up @@ -127,8 +128,19 @@ class UsageRefCollector {
}
}

// helper method not to be so verbose.
struct IsItFromMainModule {
bool operator()(clang::Decl const * const D) const {
clang::SourceManager const & SM = D->getASTContext().getSourceManager();
return SM.isFromMainFile(D->getLocation());
}
bool operator()(ScopeAnalysis::UsageRefsMap::value_type const & Var) const {
return this->operator()(Var.first);
}
};

void Report(char const * const M, clang::DiagnosticsEngine & DE) const {
boost::for_each(Results,
boost::for_each(Results | boost::adaptors::filtered(IsItFromMainModule()),
boost::bind(UsageRefCollector::Report, _1, M, boost::ref(DE)));
}

Expand Down

0 comments on commit 0d20073

Please sign in to comment.