Commit b0ead8ab authored by Kevin Modzelewski's avatar Kevin Modzelewski

Switch clang-format to C++11 mode

Looks like for now this only changes double-closing-angle-brackets
(now formats "> >" as ">>" in templates), but apparently it has
effects on raw string literals as well.
parent dc914e07
...@@ -18,7 +18,7 @@ SpaceBeforeParens: ControlStatements ...@@ -18,7 +18,7 @@ SpaceBeforeParens: ControlStatements
SpacesInAngles: false SpacesInAngles: false
SpacesInCStyleCastParentheses: false SpacesInCStyleCastParentheses: false
SpacesInParentheses: false SpacesInParentheses: false
Standard: Cpp03 Standard: Cpp11
TabWidth: 4 TabWidth: 4
UseTab: Never UseTab: Never
......
...@@ -36,10 +36,10 @@ private: ...@@ -36,10 +36,10 @@ private:
CFG* cfg; CFG* cfg;
friend class LivenessBBVisitor; friend class LivenessBBVisitor;
typedef std::unordered_map<CFGBlock*, std::unique_ptr<LivenessBBVisitor> > LivenessCacheMap; typedef std::unordered_map<CFGBlock*, std::unique_ptr<LivenessBBVisitor>> LivenessCacheMap;
LivenessCacheMap liveness_cache; LivenessCacheMap liveness_cache;
std::unordered_map<int, std::unordered_map<CFGBlock*, bool> > result_cache; std::unordered_map<int, std::unordered_map<CFGBlock*, bool>> result_cache;
// Map strings to unique indices. For a given CFG, the set of strings should be fairly small // Map strings to unique indices. For a given CFG, the set of strings should be fairly small
// (a constant fraction max of the CFG itself), so just store all of them. The theory is that // (a constant fraction max of the CFG itself), so just store all of them. The theory is that
...@@ -70,7 +70,7 @@ public: ...@@ -70,7 +70,7 @@ public:
typedef std::unordered_set<std::string> RequiredSet; typedef std::unordered_set<std::string> RequiredSet;
private: private:
std::unordered_map<CFGBlock*, std::unordered_map<std::string, DefinitionLevel> > results; std::unordered_map<CFGBlock*, std::unordered_map<std::string, DefinitionLevel>> results;
std::unordered_map<CFGBlock*, const RequiredSet> defined_at_end; std::unordered_map<CFGBlock*, const RequiredSet> defined_at_end;
ScopeInfo* scope_info; ScopeInfo* scope_info;
......
...@@ -288,7 +288,7 @@ private: ...@@ -288,7 +288,7 @@ private:
arg_types.push_back(getType(node->args[i])); arg_types.push_back(getType(node->args[i]));
} }
std::vector<std::pair<const std::string&, CompilerType*> > kw_types; std::vector<std::pair<const std::string&, CompilerType*>> kw_types;
for (AST_keyword* kw : node->keywords) { for (AST_keyword* kw : node->keywords) {
kw_types.push_back(std::make_pair<const std::string&, CompilerType*>(kw->arg, getType(kw->value))); kw_types.push_back(std::make_pair<const std::string&, CompilerType*>(kw->arg, getType(kw->value)));
} }
......
...@@ -55,7 +55,7 @@ private: ...@@ -55,7 +55,7 @@ private:
uint8_t* buf; uint8_t* buf;
std::vector<std::pair<ICInvalidator*, int64_t> > dependencies; std::vector<std::pair<ICInvalidator*, int64_t>> dependencies;
ICSlotRewrite(ICInfo* ic, const char* debug_name); ICSlotRewrite(ICInfo* ic, const char* debug_name);
......
...@@ -213,10 +213,10 @@ static bool compareBlockPairs(const std::pair<CFGBlock*, CFGBlock*>& p1, const s ...@@ -213,10 +213,10 @@ static bool compareBlockPairs(const std::pair<CFGBlock*, CFGBlock*>& p1, const s
return p1.first->idx < p2.first->idx; return p1.first->idx < p2.first->idx;
} }
static std::vector<std::pair<CFGBlock*, CFGBlock*> > static std::vector<std::pair<CFGBlock*, CFGBlock*>>
computeBlockTraversalOrder(const BlockSet& full_blocks, const BlockSet& partial_blocks, CFGBlock* start) { computeBlockTraversalOrder(const BlockSet& full_blocks, const BlockSet& partial_blocks, CFGBlock* start) {
std::vector<std::pair<CFGBlock*, CFGBlock*> > rtn; std::vector<std::pair<CFGBlock*, CFGBlock*>> rtn;
std::unordered_set<CFGBlock*> in_queue; std::unordered_set<CFGBlock*> in_queue;
if (start) { if (start) {
...@@ -552,7 +552,7 @@ static void emitBBs(IRGenState* irstate, const char* bb_type, GuardList& out_gua ...@@ -552,7 +552,7 @@ static void emitBBs(IRGenState* irstate, const char* bb_type, GuardList& out_gua
std::unordered_map<CFGBlock*, SymbolTable*> ending_symbol_tables; std::unordered_map<CFGBlock*, SymbolTable*> ending_symbol_tables;
std::unordered_map<CFGBlock*, ConcreteSymbolTable*> phi_ending_symbol_tables; std::unordered_map<CFGBlock*, ConcreteSymbolTable*> phi_ending_symbol_tables;
typedef std::unordered_map<std::string, std::pair<ConcreteCompilerType*, llvm::PHINode*> > PHITable; typedef std::unordered_map<std::string, std::pair<ConcreteCompilerType*, llvm::PHINode*>> PHITable;
std::unordered_map<CFGBlock*, PHITable*> created_phis; std::unordered_map<CFGBlock*, PHITable*> created_phis;
CFGBlock* initial_block = NULL; CFGBlock* initial_block = NULL;
...@@ -569,7 +569,7 @@ static void emitBBs(IRGenState* irstate, const char* bb_type, GuardList& out_gua ...@@ -569,7 +569,7 @@ static void emitBBs(IRGenState* irstate, const char* bb_type, GuardList& out_gua
// with a lower index value, so if the entry block is 0 then we can iterate in index // with a lower index value, so if the entry block is 0 then we can iterate in index
// order. // order.
// The entry block doesn't have to be zero, so we have to calculate an allowable order here: // The entry block doesn't have to be zero, so we have to calculate an allowable order here:
std::vector<std::pair<CFGBlock*, CFGBlock*> > traversal_order std::vector<std::pair<CFGBlock*, CFGBlock*>> traversal_order
= computeBlockTraversalOrder(full_blocks, partial_blocks, initial_block); = computeBlockTraversalOrder(full_blocks, partial_blocks, initial_block);
std::unordered_set<CFGBlock*> into_hax; std::unordered_set<CFGBlock*> into_hax;
...@@ -861,7 +861,7 @@ static void emitBBs(IRGenState* irstate, const char* bb_type, GuardList& out_gua ...@@ -861,7 +861,7 @@ static void emitBBs(IRGenState* irstate, const char* bb_type, GuardList& out_gua
// basic blocks as part of type coercion. // basic blocks as part of type coercion.
// Intsead, just make a record of the phi node, value, and the location of the from-BB, // Intsead, just make a record of the phi node, value, and the location of the from-BB,
// which we won't read until after all new BBs have been added. // which we won't read until after all new BBs have been added.
std::vector<std::tuple<llvm::PHINode*, llvm::Value*, llvm::BasicBlock*&> > phi_args; std::vector<std::tuple<llvm::PHINode*, llvm::Value*, llvm::BasicBlock*&>> phi_args;
for (PHITable::iterator it = phis->begin(); it != phis->end(); it++) { for (PHITable::iterator it = phis->begin(); it != phis->end(); it++) {
llvm::PHINode* llvm_phi = it->second.second; llvm::PHINode* llvm_phi = it->second.second;
......
...@@ -113,7 +113,7 @@ public: ...@@ -113,7 +113,7 @@ public:
private: private:
std::unordered_map<AST_expr*, ExprTypeGuard*> expr_type_guards; std::unordered_map<AST_expr*, ExprTypeGuard*> expr_type_guards;
std::unordered_map<CFGBlock*, std::vector<BlockEntryGuard*> > block_begin_guards; std::unordered_map<CFGBlock*, std::vector<BlockEntryGuard*>> block_begin_guards;
// typedef std::unordered_map<AST_expr*, ExprTypeGuard*>::iterator expr_type_guard_iterator; // typedef std::unordered_map<AST_expr*, ExprTypeGuard*>::iterator expr_type_guard_iterator;
// typedef std::unordered_map<AST_expr*, ExprTypeGuard*>::const_iterator expr_type_guard_const_iterator; // typedef std::unordered_map<AST_expr*, ExprTypeGuard*>::const_iterator expr_type_guard_const_iterator;
typedef decltype(expr_type_guards)::iterator expr_type_guard_iterator; typedef decltype(expr_type_guards)::iterator expr_type_guard_iterator;
...@@ -167,7 +167,7 @@ public: ...@@ -167,7 +167,7 @@ public:
} }
const std::vector<BlockEntryGuard*>& getGuardsForBlock(CFGBlock* block) const { const std::vector<BlockEntryGuard*>& getGuardsForBlock(CFGBlock* block) const {
std::unordered_map<CFGBlock*, std::vector<BlockEntryGuard*> >::const_iterator it std::unordered_map<CFGBlock*, std::vector<BlockEntryGuard*>>::const_iterator it
= block_begin_guards.find(block); = block_begin_guards.find(block);
if (it != block_begin_guards.end()) if (it != block_begin_guards.end())
return it->second; return it->second;
......
...@@ -98,7 +98,7 @@ public: ...@@ -98,7 +98,7 @@ public:
virtual void getAnalysisUsage(AnalysisUsage& info) const { info.setPreservesCFG(); } virtual void getAnalysisUsage(AnalysisUsage& info) const { info.setPreservesCFG(); }
virtual bool runOnBasicBlock(BasicBlock& BB) { virtual bool runOnBasicBlock(BasicBlock& BB) {
std::unordered_map<std::pair<void*, Value*>, llvm::SmallVector<CallInst*, 4> > boxing_calls; std::unordered_map<std::pair<void*, Value*>, llvm::SmallVector<CallInst*, 4>> boxing_calls;
// Find all boxInt, boxFloat and boxBool calls inside this BB and add them into a map, // Find all boxInt, boxFloat and boxBool calls inside this BB and add them into a map,
// the maps key is pair of the called function and the passed argument // the maps key is pair of the called function and the passed argument
......
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
// Allow using std::pair as keys in hashtables: // Allow using std::pair as keys in hashtables:
namespace std { namespace std {
template <typename T1, typename T2> struct hash<pair<T1, T2> > { template <typename T1, typename T2> struct hash<pair<T1, T2>> {
size_t operator()(const pair<T1, T2> p) const { return hash<T1>()(p.first) ^ (hash<T2>()(p.second) << 1); } size_t operator()(const pair<T1, T2> p) const { return hash<T1>()(p.first) ^ (hash<T2>()(p.second) << 1); }
}; };
} }
......
...@@ -53,7 +53,7 @@ int Stats::getStatId(const std::string& name) { ...@@ -53,7 +53,7 @@ int Stats::getStatId(const std::string& name) {
void Stats::dump() { void Stats::dump() {
printf("Stats:\n"); printf("Stats:\n");
std::vector<std::pair<std::string, int> > pairs; std::vector<std::pair<std::string, int>> pairs;
for (const auto& p : *names) { for (const auto& p : *names) {
pairs.push_back(make_pair(p.second, p.first)); pairs.push_back(make_pair(p.second, p.first));
} }
......
...@@ -2302,7 +2302,7 @@ Box* callFunc(BoxedFunction* func, CallRewriteArgs* rewrite_args, ArgPassSpec ar ...@@ -2302,7 +2302,7 @@ Box* callFunc(BoxedFunction* func, CallRewriteArgs* rewrite_args, ArgPassSpec ar
params_filled[i] = true; params_filled[i] = true;
} }
std::vector<Box*, StlCompatAllocator<Box*> > unused_positional; std::vector<Box*, StlCompatAllocator<Box*>> unused_positional;
for (int i = positional_to_positional; i < argspec.num_args; i++) { for (int i = positional_to_positional; i < argspec.num_args; i++) {
rewrite_args = NULL; rewrite_args = NULL;
unused_positional.push_back(getArg(i, arg1, arg2, arg3, args)); unused_positional.push_back(getArg(i, arg1, arg2, arg3, args));
......
...@@ -31,7 +31,7 @@ extern "C" Box* createSet(); ...@@ -31,7 +31,7 @@ extern "C" Box* createSet();
class BoxedSet : public Box { class BoxedSet : public Box {
public: public:
typedef std::unordered_set<Box*, PyHasher, PyEq, StlCompatAllocator<Box*> > Set; typedef std::unordered_set<Box*, PyHasher, PyEq, StlCompatAllocator<Box*>> Set;
Set s; Set s;
BoxedSet(BoxedClass* cls) __attribute__((visibility("default"))) : Box(cls) {} BoxedSet(BoxedClass* cls) __attribute__((visibility("default"))) : Box(cls) {}
......
...@@ -166,9 +166,9 @@ public: ...@@ -166,9 +166,9 @@ public:
bool operator!=(const StlCompatAllocator<T>& rhs) const { return false; } bool operator!=(const StlCompatAllocator<T>& rhs) const { return false; }
}; };
template <typename K, typename V, typename Hash = std::hash<K>, typename KeyEqual = std::equal_to<K> > template <typename K, typename V, typename Hash = std::hash<K>, typename KeyEqual = std::equal_to<K>>
class conservative_unordered_map class conservative_unordered_map
: public std::unordered_map<K, V, Hash, KeyEqual, StlCompatAllocator<std::pair<const K, V> > > {}; : public std::unordered_map<K, V, Hash, KeyEqual, StlCompatAllocator<std::pair<const K, V>>> {};
class BoxedClass : public BoxVar { class BoxedClass : public BoxVar {
public: public:
...@@ -368,7 +368,7 @@ public: ...@@ -368,7 +368,7 @@ public:
class BoxedTuple : public Box { class BoxedTuple : public Box {
public: public:
typedef std::vector<Box*, StlCompatAllocator<Box*> > GCVector; typedef std::vector<Box*, StlCompatAllocator<Box*>> GCVector;
GCVector elts; GCVector elts;
BoxedTuple(GCVector& elts) __attribute__((visibility("default"))) : Box(tuple_cls), elts(elts) {} BoxedTuple(GCVector& elts) __attribute__((visibility("default"))) : Box(tuple_cls), elts(elts) {}
...@@ -401,7 +401,7 @@ struct PyLt { ...@@ -401,7 +401,7 @@ struct PyLt {
class BoxedDict : public Box { class BoxedDict : public Box {
public: public:
typedef std::unordered_map<Box*, Box*, PyHasher, PyEq, StlCompatAllocator<std::pair<Box*, Box*> > > DictMap; typedef std::unordered_map<Box*, Box*, PyHasher, PyEq, StlCompatAllocator<std::pair<Box*, Box*>>> DictMap;
DictMap d; DictMap d;
......
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