File src/Finder.cpp changed (mode: 100644) (index 47e420f..a654233) |
20 |
20 |
|
|
21 |
21 |
#include "Finder.hpp" |
#include "Finder.hpp" |
22 |
22 |
|
|
23 |
|
#include <iostream> |
|
24 |
23 |
#include <map> |
#include <map> |
25 |
24 |
#include <string> |
#include <string> |
26 |
25 |
|
|
|
... |
... |
Finder::Impl::~Impl() { |
123 |
122 |
|
|
124 |
123 |
if (funcInfo.isFullyDeclared()) { |
if (funcInfo.isFullyDeclared()) { |
125 |
124 |
if (funcInfo.isUnused()) { |
if (funcInfo.isUnused()) { |
126 |
|
std::cout << funcInfo << ": unused\n"; |
|
|
125 |
|
llvm::outs() << funcInfo << ": unused\n"; |
127 |
126 |
} else if (funcInfo.canBeMadeStatic()) { |
} else if (funcInfo.canBeMadeStatic()) { |
128 |
|
std::cout << funcInfo << ": can be made static\n"; |
|
|
127 |
|
llvm::outs() << funcInfo << ": can be made static\n"; |
129 |
128 |
} |
} |
130 |
129 |
} |
} |
131 |
130 |
} |
} |
File src/FuncInfo.cpp changed (mode: 100644) (index 0175e72..1e60f05) |
25 |
25 |
#include <clang/Basic/SourceLocation.h> |
#include <clang/Basic/SourceLocation.h> |
26 |
26 |
#include <clang/Basic/SourceManager.h> |
#include <clang/Basic/SourceManager.h> |
27 |
27 |
|
|
28 |
|
#include <iostream> |
|
29 |
|
|
|
30 |
28 |
FuncInfo::FuncInfo(const clang::FunctionDecl *func, |
FuncInfo::FuncInfo(const clang::FunctionDecl *func, |
31 |
29 |
const clang::SourceManager *sm) |
const clang::SourceManager *sm) |
32 |
30 |
: name(func->getNameAsString()), lineNum(0U) { |
: name(func->getNameAsString()), lineNum(0U) { |
|
... |
... |
bool FuncInfo::canBeMadeStatic() const { |
62 |
60 |
return true; |
return true; |
63 |
61 |
} |
} |
64 |
62 |
|
|
65 |
|
std::ostream &operator<<(std::ostream &os, const FuncInfo &fi) { |
|
|
63 |
|
llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const FuncInfo &fi) { |
66 |
64 |
return os << fi.fileName << ':' << fi.lineNum << ':' << fi.name; |
return os << fi.fileName << ':' << fi.lineNum << ':' << fi.name; |
67 |
65 |
} |
} |
File src/FuncInfo.hpp changed (mode: 100644) (index 08d2e24..f457706) |
21 |
21 |
#ifndef UNUSED_FUNCS__FUNCINFO_HPP__ |
#ifndef UNUSED_FUNCS__FUNCINFO_HPP__ |
22 |
22 |
#define UNUSED_FUNCS__FUNCINFO_HPP__ |
#define UNUSED_FUNCS__FUNCINFO_HPP__ |
23 |
23 |
|
|
24 |
|
#include <iosfwd> |
|
|
24 |
|
#include <llvm/Support/raw_ostream.h> |
|
25 |
|
|
25 |
26 |
#include <string> |
#include <string> |
26 |
27 |
#include <vector> |
#include <vector> |
27 |
28 |
|
|
|
... |
... |
class SourceManager; |
36 |
37 |
|
|
37 |
38 |
|
|
38 |
39 |
class FuncInfo { |
class FuncInfo { |
39 |
|
friend std::ostream &operator<<(std::ostream &os, const FuncInfo &fi); |
|
|
40 |
|
friend llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const FuncInfo &fi); |
40 |
41 |
|
|
41 |
42 |
public: |
public: |
42 |
43 |
FuncInfo(const clang::FunctionDecl *func, const clang::SourceManager *sm); |
FuncInfo(const clang::FunctionDecl *func, const clang::SourceManager *sm); |
|
... |
... |
private: |
57 |
58 |
Refs calls; |
Refs calls; |
58 |
59 |
}; |
}; |
59 |
60 |
|
|
60 |
|
std::ostream &operator<<(std::ostream &os, const FuncInfo &fi); |
|
|
61 |
|
llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const FuncInfo &fi); |
61 |
62 |
|
|
62 |
63 |
#endif // UNUSED_FUNCS__FUNCINFO_HPP__ |
#endif // UNUSED_FUNCS__FUNCINFO_HPP__ |