Commit 7bf59432 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Format src/core/ again

I don't quite remember this but I think the goal was to ignore core/from_llvm, not all of core/
parent b701479b
...@@ -141,16 +141,14 @@ namespace AST_TYPE { ...@@ -141,16 +141,14 @@ namespace AST_TYPE {
/* These aren't real AST types, but since we use AST types to represent binexp types */ \ /* These aren't real AST types, but since we use AST types to represent binexp types */ \
/* and divmod+truediv are essentially types of binops, we add them here (at least for now): */ \ /* and divmod+truediv are essentially types of binops, we add them here (at least for now): */ \
X(DivMod, 250) \ X(DivMod, 250) \
X(TrueDiv, 251) \ X(TrueDiv, 251)
#define GENERATE_ENUM(ENUM, N) ENUM = N, #define GENERATE_ENUM(ENUM, N) ENUM = N,
#define GENERATE_STRING(STRING, N) m[N] = #STRING; #define GENERATE_STRING(STRING, N) m[N] = #STRING;
enum AST_TYPE { enum AST_TYPE { FOREACH_TYPE(GENERATE_ENUM) };
FOREACH_TYPE(GENERATE_ENUM)
};
static const char *stringify(int n) { static const char* stringify(int n) {
static std::map<int, const char*> m; static std::map<int, const char*> m;
FOREACH_TYPE(GENERATE_STRING) FOREACH_TYPE(GENERATE_STRING)
return m[n]; return m[n];
...@@ -159,7 +157,6 @@ static const char *stringify(int n) { ...@@ -159,7 +157,6 @@ static const char *stringify(int n) {
#undef FOREACH_TYPE #undef FOREACH_TYPE
#undef GENERATE_ENUM #undef GENERATE_ENUM
#undef GENERATE_STRING #undef GENERATE_STRING
}; };
class ASTVisitor; class ASTVisitor;
...@@ -1360,9 +1357,7 @@ private: ...@@ -1360,9 +1357,7 @@ private:
public: public:
PrintVisitor(int indent = 0, llvm::raw_ostream& stream = llvm::outs()) : stream(stream), indent(indent) {} PrintVisitor(int indent = 0, llvm::raw_ostream& stream = llvm::outs()) : stream(stream), indent(indent) {}
virtual ~PrintVisitor() {} virtual ~PrintVisitor() {}
void flush() { void flush() { stream.flush(); }
stream.flush();
}
virtual bool visit_alias(AST_alias* node); virtual bool visit_alias(AST_alias* node);
virtual bool visit_arguments(AST_arguments* node); virtual bool visit_arguments(AST_arguments* node);
......
...@@ -271,7 +271,8 @@ private: ...@@ -271,7 +271,8 @@ private:
} }
} }
raiseSyntaxError("'continue' not properly in loop", value->lineno, value->col_offset, source->getFn()->s(), "", true); raiseSyntaxError("'continue' not properly in loop", value->lineno, value->col_offset, source->getFn()->s(), "",
true);
} }
void doBreak(AST* value) { void doBreak(AST* value) {
...@@ -2527,7 +2528,8 @@ public: ...@@ -2527,7 +2528,8 @@ public:
llvm::DenseMap<InternedString, int> sym_vreg_map; llvm::DenseMap<InternedString, int> sym_vreg_map;
ScopeInfo* scope_info; ScopeInfo* scope_info;
AssignVRegsVisitor(ScopeInfo* scope_info, bool only_user_visible) : only_user_visible(only_user_visible), scope_info(scope_info) {} AssignVRegsVisitor(ScopeInfo* scope_info, bool only_user_visible)
: only_user_visible(only_user_visible), scope_info(scope_info) {}
bool visit_arguments(AST_arguments* node) override { bool visit_arguments(AST_arguments* node) override {
for (AST_expr* d : node->defaults) for (AST_expr* d : node->defaults)
...@@ -2586,8 +2588,9 @@ void CFG::assignVRegs(const ParamNames& param_names, ScopeInfo* scope_info) { ...@@ -2586,8 +2588,9 @@ void CFG::assignVRegs(const ParamNames& param_names, ScopeInfo* scope_info) {
AssignVRegsVisitor visitor(scope_info, true); AssignVRegsVisitor visitor(scope_info, true);
// we need todo two passes: first we assign the user visible vars a vreg and then the compiler created get there value. // we need todo two passes: first we assign the user visible vars a vreg and then the compiler created get there
for (int i=0; i<2; ++i) { // value.
for (int i = 0; i < 2; ++i) {
for (CFGBlock* b : blocks) { for (CFGBlock* b : blocks) {
for (AST_stmt* stmt : b->body) { for (AST_stmt* stmt : b->body) {
stmt->accept(&visitor); stmt->accept(&visitor);
......
...@@ -67,9 +67,7 @@ public: ...@@ -67,9 +67,7 @@ public:
void push_back(AST_stmt* node) { body.push_back(node); } void push_back(AST_stmt* node) { body.push_back(node); }
void print(llvm::raw_ostream& stream = llvm::outs()); void print(llvm::raw_ostream& stream = llvm::outs());
void _print() { void _print() { print(); }
print();
}
}; };
// Control Flow Graph // Control Flow Graph
......
...@@ -84,8 +84,7 @@ template <typename T1, typename T2, typename T3> struct hash<tuple<T1, T2, T3>> ...@@ -84,8 +84,7 @@ template <typename T1, typename T2, typename T3> struct hash<tuple<T1, T2, T3>>
} }
namespace pyston { namespace pyston {
template <typename T> template <typename T> constexpr bool fitsInto(int64_t x) {
constexpr bool fitsInto(int64_t x) {
return std::numeric_limits<T>::min() <= x && x <= std::numeric_limits<T>::max(); return std::numeric_limits<T>::min() <= x && x <= std::numeric_limits<T>::max();
} }
} }
......
...@@ -42,5 +42,4 @@ bool InternedString::isCompilerCreatedName() const { ...@@ -42,5 +42,4 @@ bool InternedString::isCompilerCreatedName() const {
char c = _str->s()[0]; char c = _str->s()[0];
return c == '!' || c == '#'; return c == '!' || c == '#';
} }
} }
...@@ -460,7 +460,6 @@ extern "C" void PyEval_ReInitThreads() noexcept { ...@@ -460,7 +460,6 @@ extern "C" void PyEval_ReInitThreads() noexcept {
else else
Py_DECREF(result); Py_DECREF(result);
Py_DECREF(threading); Py_DECREF(threading);
} }
void acquireGLWrite() { void acquireGLWrite() {
...@@ -599,7 +598,7 @@ extern "C" void PyThread_delete_key_value(int key) noexcept { ...@@ -599,7 +598,7 @@ extern "C" void PyThread_delete_key_value(int key) noexcept {
} }
extern "C" PyObject *_PyThread_CurrentFrames(void) noexcept { extern "C" PyObject* _PyThread_CurrentFrames(void) noexcept {
assert(0 && "check refcounting"); assert(0 && "check refcounting");
try { try {
LOCK_REGION(&threading_lock); LOCK_REGION(&threading_lock);
......
...@@ -314,7 +314,8 @@ class JitCodeBlock; ...@@ -314,7 +314,8 @@ class JitCodeBlock;
extern std::vector<Box*> constants; extern std::vector<Box*> constants;
extern std::vector<Box*> late_constants; // constants that should be freed after normal constants extern std::vector<Box*> late_constants; // constants that should be freed after normal constants
// A specific compilation of a FunctionMetadata. Usually these will be created by the LLVM JIT, which will take a FunctionMetadata // A specific compilation of a FunctionMetadata. Usually these will be created by the LLVM JIT, which will take a
// FunctionMetadata
// and some compilation settings, and produce a CompiledFunction // and some compilation settings, and produce a CompiledFunction
// CompiledFunctions can also be created from raw function pointers, using FunctionMetadata::create. // CompiledFunctions can also be created from raw function pointers, using FunctionMetadata::create.
// A single FunctionMetadata can have multiple CompiledFunctions associated with it, if they have different settings. // A single FunctionMetadata can have multiple CompiledFunctions associated with it, if they have different settings.
......
#!/usr/bin/env bash #!/usr/bin/env bash
set -eu set -eu
failed=0 failed=0
for fn in $(find . -path ./core -prune -o -name '*.cpp' -print -o -name '*.h' -print); do for fn in $(find . -path ./core/from_llvm -prune -o -name '*.cpp' -print -o -name '*.h' -print); do
diff -u $fn <($1 -style=file $fn) || failed=1 diff -u $fn <($1 -style=file $fn) || failed=1
done done
......
#!/usr/bin/env bash #!/usr/bin/env bash
set -eu set -eu
for fn in $(find . -path ./core -prune -o -name '*.cpp' -print -o -name '*.h' -print); do for fn in $(find . -path ./core/from_llvm -prune -o -name '*.cpp' -print -o -name '*.h' -print); do
$1 -i --style=file $fn $1 -i --style=file $fn
done done
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