Skip to content

Commit

Permalink
src: apply clang-format rules
Browse files Browse the repository at this point in the history
PR-URL: #276
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
mmarchini committed Mar 25, 2019
1 parent ecfbdca commit 6424992
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 29 deletions.
35 changes: 14 additions & 21 deletions src/llscan.cc
Original file line number Diff line number Diff line change
Expand Up @@ -635,38 +635,28 @@ void FindReferencesCmd::ScanForReferences(ObjectScanner* scanner) {
}

void FindReferencesCmd::PrintRecursiveReferences(
lldb::SBCommandReturnObject& result,
ScanOptions* options,
ReferencesVector* visited_references,
uint64_t address,
int level
)
{
lldb::SBCommandReturnObject& result, ScanOptions* options,
ReferencesVector* visited_references, uint64_t address, int level) {
Settings* settings = Settings::GetSettings();
unsigned int padding = settings->GetTreePadding();

std::string branch = std::string(padding * level, ' ') + "+ ";

result.Printf("%s", branch.c_str());

if (find(visited_references->begin(), visited_references->end(), address) != visited_references->end())
{
if (find(visited_references->begin(), visited_references->end(), address) !=
visited_references->end()) {
std::stringstream seen_str;
seen_str << rang::fg::red << " [seen above]" << rang::fg::reset << std::endl;
seen_str << rang::fg::red << " [seen above]" << rang::fg::reset
<< std::endl;
result.Printf(seen_str.str().c_str());
} else {
visited_references->push_back(address);
v8::Value value(llscan_->v8(), address);
ReferenceScanner scanner_(llscan_, value);
ReferencesVector* references_ = scanner_.GetReferences();
PrintReferences(
result,
references_,
&scanner_,
options,
visited_references,
level + 1
);
PrintReferences(result, references_, &scanner_, options, visited_references,
level + 1);
}
}

Expand Down Expand Up @@ -696,15 +686,17 @@ void FindReferencesCmd::PrintReferences(
scanner->PrintRefs(result, js_obj, err, level);

if (options->recursive_scan) {
PrintRecursiveReferences(result, options, already_visited_references, addr, level);
PrintRecursiveReferences(result, options, already_visited_references,
addr, level);
}

} else if (type < v8->types()->kFirstNonstringType) {
v8::String str(heap_object);
scanner->PrintRefs(result, str, err, level);

if (options->recursive_scan) {
PrintRecursiveReferences(result, options, already_visited_references, addr, level);
PrintRecursiveReferences(result, options, already_visited_references,
addr, level);
}

} else if (type == v8->types()->kJSTypedArrayType) {
Expand Down Expand Up @@ -820,7 +812,8 @@ void FindReferencesCmd::ReferenceScanner::PrintContextRefs(
search_value_.raw());

if (options->recursive_scan) {
cli_cmd_->PrintRecursiveReferences(result, options, already_visited_references, c.raw(), level);
cli_cmd_->PrintRecursiveReferences(
result, options, already_visited_references, c.raw(), level);
}
}
}
Expand Down
11 changes: 4 additions & 7 deletions src/llscan.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,10 @@ class FindReferencesCmd : public CommandBase {

void ScanForReferences(ObjectScanner* scanner);

void PrintRecursiveReferences(
lldb::SBCommandReturnObject& result,
ScanOptions* options,
ReferencesVector* visited_references,
uint64_t address,
int level
);
void PrintRecursiveReferences(lldb::SBCommandReturnObject& result,
ScanOptions* options,
ReferencesVector* visited_references,
uint64_t address, int level);

class ReferenceScanner : public ObjectScanner {
public:
Expand Down
2 changes: 1 addition & 1 deletion src/printer.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <cinttypes>
#include <sstream>
#include <iostream>
#include <sstream>

#include "deps/rang/include/rang.hpp"
#include "src/llv8-inl.h"
Expand Down

0 comments on commit 6424992

Please sign in to comment.