-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathInterfaceLister.cpp
More file actions
46 lines (39 loc) · 1.41 KB
/
InterfaceLister.cpp
File metadata and controls
46 lines (39 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//===--- InterfaceLister.cpp - clang-tidy---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "InterfaceLister.h"
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include <iostream>
using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace reporting {
void InterfaceLister::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher(cxxMemberCallExpr().bind("member"), this);
}
void InterfaceLister::check(const MatchFinder::MatchResult &Result) {
const auto *MatchedCallExpr =
Result.Nodes.getNodeAs<CXXMemberCallExpr>("member");
if (MatchedCallExpr) {
if (std::strcmp(MatchedCallExpr->getRecordDecl()
->getDeclName()
.getAsString()
.c_str(),
ClassName.c_str()) != 0)
return;
std::string sourceInfo(MatchedCallExpr->getExprLoc().printToString(
*Result.SourceManager));
std::cerr << sourceInfo << " ; " << ClassName << " : "
<< MatchedCallExpr->getMethodDecl()->getQualifiedNameAsString()
<< "\n";
}
}
} // namespace reporting
} // namespace tidy
} // namespace clang