Skip to content

Commit cb17e41

Browse files
authored
Merge pull request #73 from ksromanov/clang-format-14
Run clang-format-14 on src/ folder
2 parents 5a7f5c2 + 9a7a7be commit cb17e41

File tree

4 files changed

+17
-21
lines changed

4 files changed

+17
-21
lines changed

src/collectors/include_graph/include_graph_util.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
#include <llvm/ADT/StringRef.h>
3737
#include <llvm/Support/CommandLine.h>
3838
#include <map>
39-
#include <sstream>
4039
#include <ostream>
40+
#include <sstream>
4141
#include <string>
4242
#include <unistd.h>
4343
#include <utility>
@@ -219,8 +219,7 @@ static clang::Decl *extract_decl_for_type(const clang::Type *t) {
219219
}
220220
}
221221

222-
bool check_for_first_end(clang::CompilerInstance *ci,
223-
IncludeGraphData *data,
222+
bool check_for_first_end(clang::CompilerInstance *ci, IncludeGraphData *data,
224223
const clang::TypeLoc *n) {
225224
std::pair<FileUID, bool> tuid = get_fileuid(ci, data, n->getEndLoc());
226225

@@ -256,7 +255,7 @@ void add_type_reference(clang::CompilerInstance *ci, IncludeGraphData *data,
256255
decl = extract_decl_for_type<clang::UnresolvedUsingType>(t);
257256

258257
if (!decl || !check_for_first_end(ci, data, n)) {
259-
return;
258+
return;
260259
}
261260

262261
add_usage(ci, data, n->getBeginLoc(), decl->getLocation(), n,

src/include_graph_dependencies.cpp

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,10 @@ bool IncludeGraphDependencies::decrementUsageRefCount(
8989
return false;
9090
}
9191

92-
9392
std::set<clangmetatool::types::FileUID>
9493
IncludeGraphDependencies::collectAllIncludes(
95-
const clangmetatool::collectors::IncludeGraphData* data,
96-
const types::FileUID &fileUID)
97-
{
94+
const clangmetatool::collectors::IncludeGraphData *data,
95+
const types::FileUID &fileUID) {
9896
types::FileGraph::const_iterator rangeBegin, rangeEnd;
9997
std::tie(rangeBegin, rangeEnd) = edgeRangeStartsWith(data, fileUID);
10098

@@ -117,7 +115,6 @@ IncludeGraphDependencies::collectAllIncludes(
117115
return visitedNodes;
118116
}
119117

120-
121118
std::set<types::FileUID> IncludeGraphDependencies::liveDependencies(
122119
const collectors::IncludeGraphData *data,
123120
const clangmetatool::types::FileUID &fileUID) {
@@ -143,7 +140,8 @@ std::set<types::FileUID> IncludeGraphDependencies::liveDependencies(
143140
* Traverse the include graph for `forNode` start from `rootNode` to all
144141
* accessible node using BFS and update given DirectDependenciesMap.
145142
*
146-
* For any node that `usage_reference_count[{rootNode, toNode}] > 0`, add a record
143+
* For any node that `usage_reference_count[{rootNode, toNode}] > 0`, add a
144+
* record
147145
* `{toNode: [rootNode]}` to depsMap, means that `forNode` needs to access
148146
* resource defined in `toNode` through `rootNode`
149147
*
@@ -153,7 +151,7 @@ std::set<types::FileUID> IncludeGraphDependencies::liveDependencies(
153151
void traverseFor(const types::FileUID &forNode, const types::FileUID &rootNode,
154152
const clangmetatool::collectors::IncludeGraphData *data,
155153
std::set<types::FileUID> &knownNodes,
156-
IncludeGraphDependencies::DirectDependenciesMap& depsMap){
154+
IncludeGraphDependencies::DirectDependenciesMap &depsMap) {
157155
std::queue<types::FileUID> filesToProcess;
158156

159157
filesToProcess.push(rootNode);
@@ -165,7 +163,7 @@ void traverseFor(const types::FileUID &forNode, const types::FileUID &rootNode,
165163
types::FileGraphEdge currentEdge{forNode, toNode};
166164
auto refCountIt = data->usage_reference_count.find(currentEdge);
167165
// the include graph looks like
168-
// forNode -> rootNode -> ... -> toNode
166+
// forNode -> rootNode -> ... -> toNode
169167
if (refCountIt != data->usage_reference_count.end() &&
170168
refCountIt->second > 0) {
171169
depsMap[toNode].emplace(rootNode);
@@ -185,13 +183,12 @@ void traverseFor(const types::FileUID &forNode, const types::FileUID &rootNode,
185183
}
186184
}
187185
}
188-
189186
}
190187

191188
IncludeGraphDependencies::DirectDependenciesMap
192189
IncludeGraphDependencies::liveWeakDependencies(
193190
const clangmetatool::collectors::IncludeGraphData *data,
194-
const clangmetatool::types::FileUID &fileUID){
191+
const clangmetatool::types::FileUID &fileUID) {
195192
IncludeGraphDependencies::DirectDependenciesMap depsMap;
196193

197194
types::FileGraph::const_iterator rangeBegin, rangeEnd;
@@ -200,7 +197,7 @@ IncludeGraphDependencies::liveWeakDependencies(
200197
for (auto it = rangeBegin; it != rangeEnd; ++it) {
201198
assert(it->first == fileUID);
202199
std::set<types::FileUID> knownNodes;
203-
traverseFor(fileUID, it->second, data, knownNodes, depsMap);
200+
traverseFor(fileUID, it->second, data, knownNodes, depsMap);
204201
}
205202

206203
return depsMap;

src/propagation/propagation_visitor.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ class PropagationVisitor : public clang::ConstStmtVisitor<S> {
8787
// Find the first statement in the block, note that the statements are not
8888
// necessarily in order as stored in the block.
8989
const clang::Stmt *startStmt = nullptr;
90-
const clang::SourceManager& SM = AC.getSourceManager();
90+
const clang::SourceManager &SM = AC.getSourceManager();
9191
for (auto elem : *block) {
9292
const clang::Stmt *elemStmt = nullptr;
93-
if (util::getStmtFromCFGElement(elemStmt, elem)
94-
&& (!startStmt
95-
|| SM.isBeforeInTranslationUnit(elemStmt->getBeginLoc(),
96-
startStmt->getBeginLoc()))) {
93+
if (util::getStmtFromCFGElement(elemStmt, elem) &&
94+
(!startStmt ||
95+
SM.isBeforeInTranslationUnit(elemStmt->getBeginLoc(),
96+
startStmt->getBeginLoc()))) {
9797
startStmt = elemStmt;
9898
}
9999
}

src/tool_application_support.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ std::string getExecutablePathFromArgv(const std::string &argv0) {
4646
exePath = argv0;
4747
if (!llvm::sys::path::has_parent_path(exePath)) {
4848
llvm::Optional<std::string> maybeExePath =
49-
llvm::sys::Process::FindInEnvPath("PATH", argv0);
49+
llvm::sys::Process::FindInEnvPath("PATH", argv0);
5050
exePath = maybeExePath.getValueOr("");
5151
}
5252
}

0 commit comments

Comments
 (0)