Commit 06f5410d authored by Kevin Modzelewski's avatar Kevin Modzelewski

Merge pull request #515 from tjhance:clang_format_initializer_lists

parents 48b307bb 3dc5cd78
...@@ -9,6 +9,7 @@ AllowShortIfStatementsOnASingleLine: false ...@@ -9,6 +9,7 @@ AllowShortIfStatementsOnASingleLine: false
BreakBeforeBraces: Attach BreakBeforeBraces: Attach
BreakConstructorInitializersBeforeComma: false BreakConstructorInitializersBeforeComma: false
ColumnLimit: 120 ColumnLimit: 120
ConstructorInitializerAllOnOneLineOrOnePerLine: true
IndentCaseLabels: true IndentCaseLabels: true
IndentWidth: 4 IndentWidth: 4
Language: Cpp Language: Cpp
......
...@@ -244,8 +244,13 @@ struct ScopingAnalysis::ScopeNameUsage { ...@@ -244,8 +244,13 @@ struct ScopingAnalysis::ScopeNameUsage {
bool child_free; bool child_free;
ScopeNameUsage(AST* node, ScopeNameUsage* parent, ScopingAnalysis* scoping) ScopeNameUsage(AST* node, ScopeNameUsage* parent, ScopingAnalysis* scoping)
: node(node), parent(parent), scoping(scoping), nameForcingNodeImportStar(NULL), nameForcingNodeBareExec(NULL), : node(node),
free(false), child_free(false) { parent(parent),
scoping(scoping),
nameForcingNodeImportStar(NULL),
nameForcingNodeBareExec(NULL),
free(false),
child_free(false) {
if (node->type == AST_TYPE::ClassDef) { if (node->type == AST_TYPE::ClassDef) {
AST_ClassDef* classdef = ast_cast<AST_ClassDef>(node); AST_ClassDef* classdef = ast_cast<AST_ClassDef>(node);
...@@ -303,7 +308,11 @@ private: ...@@ -303,7 +308,11 @@ private:
public: public:
ScopeInfoBase(ScopeInfo* parent, ScopingAnalysis::ScopeNameUsage* usage, AST* ast, bool usesNameLookup, ScopeInfoBase(ScopeInfo* parent, ScopingAnalysis::ScopeNameUsage* usage, AST* ast, bool usesNameLookup,
bool globals_from_module) bool globals_from_module)
: parent(parent), usage(usage), ast(ast), usesNameLookup_(usesNameLookup), allDerefVarsAndInfoCached(false), : parent(parent),
usage(usage),
ast(ast),
usesNameLookup_(usesNameLookup),
allDerefVarsAndInfoCached(false),
globals_from_module(globals_from_module) { globals_from_module(globals_from_module) {
assert(usage); assert(usage);
assert(ast); assert(ast);
......
...@@ -98,8 +98,12 @@ private: ...@@ -98,8 +98,12 @@ private:
BasicBlockTypePropagator(CFGBlock* block, TypeMap& initial, ExprTypeMap& expr_types, BasicBlockTypePropagator(CFGBlock* block, TypeMap& initial, ExprTypeMap& expr_types,
TypeSpeculations& type_speculations, TypeAnalysis::SpeculationLevel speculation, TypeSpeculations& type_speculations, TypeAnalysis::SpeculationLevel speculation,
ScopeInfo* scope_info) ScopeInfo* scope_info)
: block(block), sym_table(initial), expr_types(expr_types), type_speculations(type_speculations), : block(block),
speculation(speculation), scope_info(scope_info) {} sym_table(initial),
expr_types(expr_types),
type_speculations(type_speculations),
speculation(speculation),
scope_info(scope_info) {}
void run() { void run() {
for (int i = 0; i < block->body.size(); i++) { for (int i = 0; i < block->body.size(); i++) {
...@@ -661,7 +665,9 @@ private: ...@@ -661,7 +665,9 @@ private:
PropagatingTypeAnalysis(const AllTypeMap& starting_types, const ExprTypeMap& expr_types, PropagatingTypeAnalysis(const AllTypeMap& starting_types, const ExprTypeMap& expr_types,
TypeSpeculations& type_speculations, SpeculationLevel speculation) TypeSpeculations& type_speculations, SpeculationLevel speculation)
: starting_types(starting_types), expr_types(expr_types), type_speculations(type_speculations), : starting_types(starting_types),
expr_types(expr_types),
type_speculations(type_speculations),
speculation(speculation) {} speculation(speculation) {}
public: public:
......
...@@ -182,10 +182,20 @@ ICSlotInfo* ICInfo::pickEntryForRewrite(const char* debug_name) { ...@@ -182,10 +182,20 @@ ICSlotInfo* ICInfo::pickEntryForRewrite(const char* debug_name) {
ICInfo::ICInfo(void* start_addr, void* slowpath_rtn_addr, void* continue_addr, StackInfo stack_info, int num_slots, ICInfo::ICInfo(void* start_addr, void* slowpath_rtn_addr, void* continue_addr, StackInfo stack_info, int num_slots,
int slot_size, llvm::CallingConv::ID calling_conv, const std::unordered_set<int>& live_outs, int slot_size, llvm::CallingConv::ID calling_conv, const std::unordered_set<int>& live_outs,
assembler::GenericRegister return_register, TypeRecorder* type_recorder) assembler::GenericRegister return_register, TypeRecorder* type_recorder)
: next_slot_to_try(0), stack_info(stack_info), num_slots(num_slots), slot_size(slot_size), : next_slot_to_try(0),
calling_conv(calling_conv), live_outs(live_outs.begin(), live_outs.end()), return_register(return_register), stack_info(stack_info),
type_recorder(type_recorder), retry_in(0), retry_backoff(1), times_rewritten(0), start_addr(start_addr), num_slots(num_slots),
slowpath_rtn_addr(slowpath_rtn_addr), continue_addr(continue_addr) { slot_size(slot_size),
calling_conv(calling_conv),
live_outs(live_outs.begin(), live_outs.end()),
return_register(return_register),
type_recorder(type_recorder),
retry_in(0),
retry_backoff(1),
times_rewritten(0),
start_addr(start_addr),
slowpath_rtn_addr(slowpath_rtn_addr),
continue_addr(continue_addr) {
for (int i = 0; i < num_slots; i++) { for (int i = 0; i < num_slots; i++) {
slots.push_back(ICSlotInfo(this, i)); slots.push_back(ICSlotInfo(this, i));
} }
......
...@@ -1379,8 +1379,13 @@ TypeRecorder* Rewriter::getTypeRecorder() { ...@@ -1379,8 +1379,13 @@ TypeRecorder* Rewriter::getTypeRecorder() {
} }
Rewriter::Rewriter(ICSlotRewrite* rewrite, int num_args, const std::vector<int>& live_outs) Rewriter::Rewriter(ICSlotRewrite* rewrite, int num_args, const std::vector<int>& live_outs)
: rewrite(rewrite), assembler(rewrite->getAssembler()), return_location(rewrite->returnRegister()), : rewrite(rewrite),
added_changing_action(false), marked_inside_ic(false), last_guard_action(-1), done_guarding(false) { assembler(rewrite->getAssembler()),
return_location(rewrite->returnRegister()),
added_changing_action(false),
marked_inside_ic(false),
last_guard_action(-1),
done_guarding(false) {
initPhaseCollecting(); initPhaseCollecting();
#ifndef NDEBUG #ifndef NDEBUG
......
...@@ -223,9 +223,18 @@ void ASTInterpreter::gcVisit(GCVisitor* visitor) { ...@@ -223,9 +223,18 @@ void ASTInterpreter::gcVisit(GCVisitor* visitor) {
} }
ASTInterpreter::ASTInterpreter(CompiledFunction* compiled_function) ASTInterpreter::ASTInterpreter(CompiledFunction* compiled_function)
: compiled_func(compiled_function), source_info(compiled_function->clfunc->source.get()), scope_info(0), phis(NULL), : compiled_func(compiled_function),
current_block(0), current_inst(0), last_exception(NULL, NULL, NULL), passed_closure(0), created_closure(0), source_info(compiled_function->clfunc->source.get()),
generator(0), edgecount(0), frame_info(ExcInfo(NULL, NULL, NULL)) { scope_info(0),
phis(NULL),
current_block(0),
current_inst(0),
last_exception(NULL, NULL, NULL),
passed_closure(0),
created_closure(0),
generator(0),
edgecount(0),
frame_info(ExcInfo(NULL, NULL, NULL)) {
CLFunction* f = compiled_function->clfunc; CLFunction* f = compiled_function->clfunc;
if (!source_info->cfg) if (!source_info->cfg)
......
...@@ -45,8 +45,16 @@ extern "C" void dumpLLVM(llvm::Value* v) { ...@@ -45,8 +45,16 @@ extern "C" void dumpLLVM(llvm::Value* v) {
IRGenState::IRGenState(CompiledFunction* cf, SourceInfo* source_info, std::unique_ptr<LivenessAnalysis> liveness, IRGenState::IRGenState(CompiledFunction* cf, SourceInfo* source_info, std::unique_ptr<LivenessAnalysis> liveness,
std::unique_ptr<PhiAnalysis> phis, ParamNames* param_names, GCBuilder* gc, std::unique_ptr<PhiAnalysis> phis, ParamNames* param_names, GCBuilder* gc,
llvm::MDNode* func_dbg_info) llvm::MDNode* func_dbg_info)
: cf(cf), source_info(source_info), liveness(std::move(liveness)), phis(std::move(phis)), param_names(param_names), : cf(cf),
gc(gc), func_dbg_info(func_dbg_info), scratch_space(NULL), frame_info(NULL), frame_info_arg(NULL), source_info(source_info),
liveness(std::move(liveness)),
phis(std::move(phis)),
param_names(param_names),
gc(gc),
func_dbg_info(func_dbg_info),
scratch_space(NULL),
frame_info(NULL),
frame_info_arg(NULL),
scratch_size(0) { scratch_size(0) {
assert(cf->func); assert(cf->func);
assert(!cf->clfunc); // in this case don't need to pass in sourceinfo assert(!cf->clfunc); // in this case don't need to pass in sourceinfo
...@@ -437,8 +445,13 @@ private: ...@@ -437,8 +445,13 @@ private:
public: public:
IRGeneratorImpl(IRGenState* irstate, std::unordered_map<CFGBlock*, llvm::BasicBlock*>& entry_blocks, IRGeneratorImpl(IRGenState* irstate, std::unordered_map<CFGBlock*, llvm::BasicBlock*>& entry_blocks,
CFGBlock* myblock, TypeAnalysis* types) CFGBlock* myblock, TypeAnalysis* types)
: irstate(irstate), curblock(entry_blocks[myblock]), emitter(irstate, curblock, this), : irstate(irstate),
entry_blocks(entry_blocks), myblock(myblock), types(types), state(RUNNING) {} curblock(entry_blocks[myblock]),
emitter(irstate, curblock, this),
entry_blocks(entry_blocks),
myblock(myblock),
types(types),
state(RUNNING) {}
~IRGeneratorImpl() { delete emitter.getBuilder(); } ~IRGeneratorImpl() { delete emitter.getBuilder(); }
......
...@@ -56,7 +56,10 @@ private: ...@@ -56,7 +56,10 @@ private:
unsigned int id; unsigned int id;
PatchpointInfo(CompiledFunction* parent_cf, const ICSetupInfo* icinfo, int num_ic_stackmap_args) PatchpointInfo(CompiledFunction* parent_cf, const ICSetupInfo* icinfo, int num_ic_stackmap_args)
: parent_cf(parent_cf), icinfo(icinfo), num_ic_stackmap_args(num_ic_stackmap_args), num_frame_stackmap_args(-1), : parent_cf(parent_cf),
icinfo(icinfo),
num_ic_stackmap_args(num_ic_stackmap_args),
num_frame_stackmap_args(-1),
id(0) {} id(0) {}
...@@ -115,7 +118,10 @@ public: ...@@ -115,7 +118,10 @@ public:
private: private:
ICSetupInfo(ICType type, int num_slots, int slot_size, bool has_return_value, TypeRecorder* type_recorder) ICSetupInfo(ICType type, int num_slots, int slot_size, bool has_return_value, TypeRecorder* type_recorder)
: type(type), num_slots(num_slots), slot_size(slot_size), has_return_value(has_return_value), : type(type),
num_slots(num_slots),
slot_size(slot_size),
has_return_value(has_return_value),
type_recorder(type_recorder) {} type_recorder(type_recorder) {}
public: public:
......
...@@ -707,7 +707,9 @@ public: ...@@ -707,7 +707,9 @@ public:
virtual void* accept_expr(ExprVisitor* v); virtual void* accept_expr(ExprVisitor* v);
AST_Name(InternedString id, AST_TYPE::AST_TYPE ctx_type, int lineno, int col_offset = 0) AST_Name(InternedString id, AST_TYPE::AST_TYPE ctx_type, int lineno, int col_offset = 0)
: AST_expr(AST_TYPE::Name, lineno, col_offset), ctx_type(ctx_type), id(id), : AST_expr(AST_TYPE::Name, lineno, col_offset),
ctx_type(ctx_type),
id(id),
lookup_type(ScopeInfo::VarScopeType::UNKNOWN) {} lookup_type(ScopeInfo::VarScopeType::UNKNOWN) {}
static const AST_TYPE::AST_TYPE TYPE = AST_TYPE::Name; static const AST_TYPE::AST_TYPE TYPE = AST_TYPE::Name;
......
...@@ -147,8 +147,12 @@ private: ...@@ -147,8 +147,12 @@ private:
ContInfo(CFGBlock* continue_dest, CFGBlock* break_dest, CFGBlock* return_dest, bool say_why, ContInfo(CFGBlock* continue_dest, CFGBlock* break_dest, CFGBlock* return_dest, bool say_why,
InternedString why_name) InternedString why_name)
: continue_dest(continue_dest), break_dest(break_dest), return_dest(return_dest), say_why(say_why), : continue_dest(continue_dest),
did_why(0), why_name(why_name) {} break_dest(break_dest),
return_dest(return_dest),
say_why(say_why),
did_why(0),
why_name(why_name) {}
}; };
struct ExcBlockInfo { struct ExcBlockInfo {
...@@ -179,7 +183,10 @@ private: ...@@ -179,7 +183,10 @@ private:
public: public:
CFGVisitor(SourceInfo* source, AST_TYPE::AST_TYPE root_type, FutureFlags future_flags, CFGVisitor(SourceInfo* source, AST_TYPE::AST_TYPE root_type, FutureFlags future_flags,
ScopingAnalysis* scoping_analysis, CFG* cfg) ScopingAnalysis* scoping_analysis, CFG* cfg)
: source(source), root_type(root_type), future_flags(future_flags), cfg(cfg), : source(source),
root_type(root_type),
future_flags(future_flags),
cfg(cfg),
scoping_analysis(scoping_analysis) { scoping_analysis(scoping_analysis) {
curblock = cfg->addBlock(); curblock = cfg->addBlock();
curblock->info = "entry"; curblock->info = "entry";
......
...@@ -200,8 +200,16 @@ public: ...@@ -200,8 +200,16 @@ public:
CompiledFunction(llvm::Function* func, FunctionSpecialization* spec, bool is_interpreted, void* code, CompiledFunction(llvm::Function* func, FunctionSpecialization* spec, bool is_interpreted, void* code,
EffortLevel effort, const OSREntryDescriptor* entry_descriptor) EffortLevel effort, const OSREntryDescriptor* entry_descriptor)
: clfunc(NULL), func(func), spec(spec), entry_descriptor(entry_descriptor), is_interpreted(is_interpreted), : clfunc(NULL),
code(code), effort(effort), times_called(0), times_speculation_failed(0), location_map(nullptr) { func(func),
spec(spec),
entry_descriptor(entry_descriptor),
is_interpreted(is_interpreted),
code(code),
effort(effort),
times_called(0),
times_speculation_failed(0),
location_map(nullptr) {
assert((spec != NULL) + (entry_descriptor != NULL) == 1); assert((spec != NULL) + (entry_descriptor != NULL) == 1);
} }
...@@ -292,13 +300,25 @@ public: ...@@ -292,13 +300,25 @@ public:
CLFunction(int num_args, int num_defaults, bool takes_varargs, bool takes_kwargs, CLFunction(int num_args, int num_defaults, bool takes_varargs, bool takes_kwargs,
std::unique_ptr<SourceInfo> source) std::unique_ptr<SourceInfo> source)
: num_args(num_args), num_defaults(num_defaults), takes_varargs(takes_varargs), takes_kwargs(takes_kwargs), : num_args(num_args),
source(std::move(source)), param_names(this->source->ast), always_use_version(NULL), code_obj(NULL) { num_defaults(num_defaults),
takes_varargs(takes_varargs),
takes_kwargs(takes_kwargs),
source(std::move(source)),
param_names(this->source->ast),
always_use_version(NULL),
code_obj(NULL) {
assert(num_args >= num_defaults); assert(num_args >= num_defaults);
} }
CLFunction(int num_args, int num_defaults, bool takes_varargs, bool takes_kwargs, const ParamNames& param_names) CLFunction(int num_args, int num_defaults, bool takes_varargs, bool takes_kwargs, const ParamNames& param_names)
: num_args(num_args), num_defaults(num_defaults), takes_varargs(takes_varargs), takes_kwargs(takes_kwargs), : num_args(num_args),
source(nullptr), param_names(param_names), always_use_version(NULL), code_obj(NULL) { num_defaults(num_defaults),
takes_varargs(takes_varargs),
takes_kwargs(takes_kwargs),
source(nullptr),
param_names(param_names),
always_use_version(NULL),
code_obj(NULL) {
assert(num_args >= num_defaults); assert(num_args >= num_defaults);
} }
......
...@@ -224,8 +224,17 @@ extern "C" BoxedGenerator* createGenerator(BoxedFunctionBase* function, Box* arg ...@@ -224,8 +224,17 @@ extern "C" BoxedGenerator* createGenerator(BoxedFunctionBase* function, Box* arg
extern "C" BoxedGenerator::BoxedGenerator(BoxedFunctionBase* function, Box* arg1, Box* arg2, Box* arg3, Box** args) extern "C" BoxedGenerator::BoxedGenerator(BoxedFunctionBase* function, Box* arg1, Box* arg2, Box* arg3, Box** args)
: function(function), arg1(arg1), arg2(arg2), arg3(arg3), args(nullptr), entryExited(false), running(false), : function(function),
returnValue(nullptr), exception(nullptr, nullptr, nullptr), context(nullptr), returnContext(nullptr) { arg1(arg1),
arg2(arg2),
arg3(arg3),
args(nullptr),
entryExited(false),
running(false),
returnValue(nullptr),
exception(nullptr, nullptr, nullptr),
context(nullptr),
returnContext(nullptr) {
int numArgs = function->f->num_args; int numArgs = function->f->num_args;
if (numArgs > 3) { if (numArgs > 3) {
......
...@@ -319,8 +319,13 @@ void BoxedClass::freeze() { ...@@ -319,8 +319,13 @@ void BoxedClass::freeze() {
BoxedClass::BoxedClass(BoxedClass* base, gcvisit_func gc_visit, int attrs_offset, int weaklist_offset, BoxedClass::BoxedClass(BoxedClass* base, gcvisit_func gc_visit, int attrs_offset, int weaklist_offset,
int instance_size, bool is_user_defined) int instance_size, bool is_user_defined)
: attrs(HiddenClass::makeSingleton()), gc_visit(gc_visit), simple_destructor(NULL), attrs_offset(attrs_offset), : attrs(HiddenClass::makeSingleton()),
is_constant(false), is_user_defined(is_user_defined), is_pyston_class(true) { gc_visit(gc_visit),
simple_destructor(NULL),
attrs_offset(attrs_offset),
is_constant(false),
is_user_defined(is_user_defined),
is_pyston_class(true) {
// Zero out the CPython tp_* slots: // Zero out the CPython tp_* slots:
memset(&tp_name, 0, (char*)(&tp_version_tag + 1) - (char*)(&tp_name)); memset(&tp_name, 0, (char*)(&tp_version_tag + 1) - (char*)(&tp_name));
...@@ -401,7 +406,8 @@ void BoxedClass::finishInitialization() { ...@@ -401,7 +406,8 @@ void BoxedClass::finishInitialization() {
BoxedHeapClass::BoxedHeapClass(BoxedClass* base, gcvisit_func gc_visit, int attrs_offset, int weaklist_offset, BoxedHeapClass::BoxedHeapClass(BoxedClass* base, gcvisit_func gc_visit, int attrs_offset, int weaklist_offset,
int instance_size, bool is_user_defined, BoxedString* name) int instance_size, bool is_user_defined, BoxedString* name)
: BoxedClass(base, gc_visit, attrs_offset, weaklist_offset, instance_size, is_user_defined), ht_name(name), : BoxedClass(base, gc_visit, attrs_offset, weaklist_offset, instance_size, is_user_defined),
ht_name(name),
ht_slots(NULL) { ht_slots(NULL) {
tp_as_number = &as_number; tp_as_number = &as_number;
......
...@@ -30,7 +30,11 @@ struct GetattrRewriteArgs { ...@@ -30,7 +30,11 @@ struct GetattrRewriteArgs {
bool obj_hcls_guarded; bool obj_hcls_guarded;
GetattrRewriteArgs(Rewriter* rewriter, RewriterVar* obj, Location destination) GetattrRewriteArgs(Rewriter* rewriter, RewriterVar* obj, Location destination)
: rewriter(rewriter), obj(obj), destination(destination), out_success(false), out_rtn(NULL), : rewriter(rewriter),
obj(obj),
destination(destination),
out_success(false),
out_rtn(NULL),
obj_hcls_guarded(false) {} obj_hcls_guarded(false) {}
}; };
...@@ -78,8 +82,17 @@ struct CallRewriteArgs { ...@@ -78,8 +82,17 @@ struct CallRewriteArgs {
RewriterVar* out_rtn; RewriterVar* out_rtn;
CallRewriteArgs(Rewriter* rewriter, RewriterVar* obj, Location destination) CallRewriteArgs(Rewriter* rewriter, RewriterVar* obj, Location destination)
: rewriter(rewriter), obj(obj), arg1(NULL), arg2(NULL), arg3(NULL), args(NULL), func_guarded(false), : rewriter(rewriter),
args_guarded(false), destination(destination), out_success(false), out_rtn(NULL) {} obj(obj),
arg1(NULL),
arg2(NULL),
arg3(NULL),
args(NULL),
func_guarded(false),
args_guarded(false),
destination(destination),
out_success(false),
out_rtn(NULL) {}
}; };
struct BinopRewriteArgs { struct BinopRewriteArgs {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment