summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorJohn Hodge (Mutabah) <acessdev@gmail.com>2016-12-25 17:19:27 +1100
committerGitHub <noreply@github.com>2016-12-25 17:19:27 +1100
commit753a2f44cc4c00b952cddae2ceed066ebb18a470 (patch)
treeed4bbff4be39c44c57164641f4ed32b5ad4675f0 /src/include
parentd12a8a886caf2e0edf33c1af831b1df990d2c892 (diff)
parent0c14c734fa32014fd24297ccdbed927016185ffd (diff)
downloadmrust-753a2f44cc4c00b952cddae2ceed066ebb18a470.tar.gz
Merge pull request #11 from ubsan/whitespace-fix
No more tears!
Diffstat (limited to 'src/include')
-rw-r--r--src/include/debug.hpp2
-rw-r--r--src/include/ident.hpp26
-rw-r--r--src/include/rc_string.hpp10
-rw-r--r--src/include/rustic.hpp16
-rw-r--r--src/include/serialise.hpp14
-rw-r--r--src/include/serialiser_texttree.hpp10
-rw-r--r--src/include/span.hpp10
-rw-r--r--src/include/synext_decorator.hpp10
-rw-r--r--src/include/tagged_union.hpp4
9 files changed, 51 insertions, 51 deletions
diff --git a/src/include/debug.hpp b/src/include/debug.hpp
index cb258bf5..ce2f89da 100644
--- a/src/include/debug.hpp
+++ b/src/include/debug.hpp
@@ -30,7 +30,7 @@ struct RepeatLitStr
{
const char *s;
int n;
-
+
friend ::std::ostream& operator<<(::std::ostream& os, const RepeatLitStr& r) {
for(int i = 0; i < r.n; i ++ )
os << r.s;
diff --git a/src/include/ident.hpp b/src/include/ident.hpp
index 1122a68b..d702385c 100644
--- a/src/include/ident.hpp
+++ b/src/include/ident.hpp
@@ -14,9 +14,9 @@ struct Ident
class Hygiene
{
static unsigned g_next_scope;
-
+
::std::vector<unsigned int> contexts;
-
+
Hygiene(unsigned int index):
contexts({index})
{}
@@ -24,7 +24,7 @@ struct Ident
Hygiene():
contexts({})
{}
-
+
static Hygiene new_scope()
{
return Hygiene(++g_next_scope);
@@ -37,23 +37,23 @@ struct Ident
rv.contexts.push_back( ++g_next_scope );
return rv;
}
-
+
Hygiene(Hygiene&& x) = default;
Hygiene(const Hygiene& x) = default;
Hygiene& operator=(Hygiene&& x) = default;
Hygiene& operator=(const Hygiene& x) = default;
-
+
// Returns true if an ident with hygine `souce` can see an ident with this hygine
bool is_visible(const Hygiene& source) const;
//bool operator==(const Hygiene& x) const { return scope_index == x.scope_index; }
//bool operator!=(const Hygiene& x) const { return scope_index != x.scope_index; }
-
+
friend ::std::ostream& operator<<(::std::ostream& os, const Hygiene& v);
};
-
+
Hygiene hygiene;
::std::string name;
-
+
Ident(const char* name):
hygiene(),
name(name)
@@ -65,20 +65,20 @@ struct Ident
Ident(Hygiene hygiene, ::std::string name):
hygiene(::std::move(hygiene)), name(::std::move(name))
{ }
-
+
Ident(Ident&& x) = default;
Ident(const Ident& x) = default;
Ident& operator=(Ident&& x) = default;
Ident& operator=(const Ident& x) = default;
-
+
::std::string into_string() {
return ::std::move(name);
}
-
+
bool operator==(const char* s) const {
return this->name == s;
}
-
+
bool operator==(const Ident& x) const {
if( this->name != x.name )
return false;
@@ -90,6 +90,6 @@ struct Ident
return !(*this == x);
}
bool operator<(const Ident& x) const;
-
+
friend ::std::ostream& operator<<(::std::ostream& os, const Ident& x);
};
diff --git a/src/include/rc_string.hpp b/src/include/rc_string.hpp
index 630f8e89..fd230062 100644
--- a/src/include/rc_string.hpp
+++ b/src/include/rc_string.hpp
@@ -23,7 +23,7 @@ public:
RcString(s.data(), s.size())
{
}
-
+
RcString(const RcString& x):
m_ptr(x.m_ptr),
m_len(x.m_len)
@@ -37,9 +37,9 @@ public:
x.m_ptr = nullptr;
x.m_len = 0;
}
-
+
~RcString();
-
+
RcString& operator=(const RcString& x)
{
if( &x != this )
@@ -63,8 +63,8 @@ public:
}
return *this;
}
-
-
+
+
const char* c_str() const {
if( m_len > 0 )
{
diff --git a/src/include/rustic.hpp b/src/include/rustic.hpp
index 5d768152..93992f61 100644
--- a/src/include/rustic.hpp
+++ b/src/include/rustic.hpp
@@ -24,11 +24,11 @@ public:
m_first(ptr),
m_len(len)
{}
-
+
::std::vector<T> to_vec() const {
return ::std::vector<T>(begin(), end());
}
-
+
unsigned int size() const {
return m_len;
}
@@ -42,7 +42,7 @@ public:
assert(ofs + len <= m_len);
return slice { m_first + ofs, len };
}
-
+
T* begin() const { return m_first; }
T* end() const { return m_first + m_len; }
@@ -73,7 +73,7 @@ class option
{
char m_data[ sizeof(T) ];
bool m_set;
-
+
void* data_ptr() { return m_data; }
const void* data_ptr() const { return m_data; }
public:
@@ -90,15 +90,15 @@ public:
reinterpret_cast<T*>(data_ptr())->~T();
}
}
-
+
bool is_none() const { return !m_set; }
bool is_some() const { return m_set; }
-
+
const T& unwrap() const {
assert(is_some());
return *reinterpret_cast<const T*>(m_data);
}
-
+
void if_set(::std::function<void (const T&)> f) const {
if( m_set ) {
return f(m_data);
@@ -125,7 +125,7 @@ public:
option():
m_ptr(nullptr)
{}
-
+
bool is_none() const { return m_ptr == nullptr; }
bool is_some() const { return m_ptr != nullptr; }
T& unwrap() const {
diff --git a/src/include/serialise.hpp b/src/include/serialise.hpp
index db311bb1..6a9abf95 100644
--- a/src/include/serialise.hpp
+++ b/src/include/serialise.hpp
@@ -19,7 +19,7 @@ class Deserialiser;
#define SERIALISE_TYPE(method_prefix, tag_str, body, des_body) \
const char* method_prefix serialise_tag() const { return tag_str; } \
void method_prefix serialise(::Serialiser& s) const { body } \
- void method_prefix deserialise(::Deserialiser& s) { des_body }
+ void method_prefix deserialise(::Deserialiser& s) { des_body }
#define SERIALISE_TYPE_A(method_prefix, tag_str, body) SERIALISE_TYPE(method_prefix, tag_str, body, body)
#define SERIALISE_TYPE_S(class_, body) SERIALISE_TYPE(class_::, #class_, body, body)
#define SERIALISE_TU(class_, tag_str, val_name, ...) SERIALISE_TYPE(class_::, tag_str,\
@@ -74,7 +74,7 @@ protected:
public:
template<typename T>
inline void item(T& v) { *this << v; }
-
+
virtual Serialiser& operator<<(bool val) = 0;
virtual Serialiser& operator<<(uint64_t val) = 0;
virtual Serialiser& operator<<(int64_t val) = 0;
@@ -149,7 +149,7 @@ public:
virtual void start_object(const char *tag) = 0;
virtual void end_object(const char *tag) = 0;
::std::string start_object();
-
+
void item(Serialisable& v);
Deserialiser& operator>>(Serialisable& v) {
this->item(v);
@@ -171,9 +171,9 @@ public:
void item(::std::shared_ptr<T>& v)
{
bool present;
-
+
item(present);
-
+
if(present) {
v.reset(new T);
item(*v);
@@ -186,9 +186,9 @@ public:
void item(::std::unique_ptr<T>& v)
{
bool present;
-
+
item(present);
-
+
if(present) {
v.reset( T::from_deserialiser(*this).release() );
}
diff --git a/src/include/serialiser_texttree.hpp b/src/include/serialiser_texttree.hpp
index bdad7d7a..7c86d326 100644
--- a/src/include/serialiser_texttree.hpp
+++ b/src/include/serialiser_texttree.hpp
@@ -16,13 +16,13 @@ class Serialiser_TextTree:
bool m_array_was_empty;
public:
Serialiser_TextTree(::std::ostream& os);
-
+
virtual Serialiser& operator<<(bool val) override;
virtual Serialiser& operator<<(uint64_t val) override;
virtual Serialiser& operator<<(int64_t val) override;
virtual Serialiser& operator<<(double val) override;
virtual Serialiser& operator<<(const char* s) override;
-
+
protected:
virtual void start_object(const char *tag) override;
virtual void end_object(const char* tag) override;
@@ -39,15 +39,15 @@ class Deserialiser_TextTree:
public Deserialiser
{
::std::istream& m_is;
-
+
static bool is_ws(char c);
char getc();
char peekc();
void eat_ws();
public:
Deserialiser_TextTree(::std::istream& is);
-
-protected:
+
+protected:
virtual size_t start_array() override;
virtual void end_array() override;
virtual ::std::string read_tag() override;
diff --git a/src/include/span.hpp b/src/include/span.hpp
index eafebb0a..11ffc005 100644
--- a/src/include/span.hpp
+++ b/src/include/span.hpp
@@ -24,19 +24,19 @@ class Position;
struct ProtoSpan
{
RcString filename;
-
+
unsigned int start_line;
unsigned int start_ofs;
};
struct Span
{
RcString filename;
-
+
unsigned int start_line;
unsigned int start_ofs;
unsigned int end_line;
unsigned int end_ofs;
-
+
Span(RcString filename, unsigned int start_line, unsigned int start_ofs, unsigned int end_line, unsigned int end_ofs):
filename( ::std::move(filename) ),
start_line(start_line),
@@ -47,12 +47,12 @@ struct Span
Span(const Span& x);
Span(const Position& position);
Span();
-
+
void bug(::std::function<void(::std::ostream&)> msg) const;
void error(ErrorType tag, ::std::function<void(::std::ostream&)> msg) const;
void warning(WarningType tag, ::std::function<void(::std::ostream&)> msg) const;
void note(::std::function<void(::std::ostream&)> msg) const;
-
+
friend ::std::ostream& operator<<(::std::ostream& os, const Span& sp);
};
diff --git a/src/include/synext_decorator.hpp b/src/include/synext_decorator.hpp
index 0404889f..c3985855 100644
--- a/src/include/synext_decorator.hpp
+++ b/src/include/synext_decorator.hpp
@@ -18,14 +18,14 @@ namespace AST {
struct StructItem;
struct TupleItem;
struct EnumVariant;
-
+
class Module;
class Item;
-
+
class Expr;
class ExprNode;
struct ExprNode_Match_Arm;
-
+
class ImplDef;
}
@@ -40,7 +40,7 @@ class ExpandDecorator
void unexpected(const Span& sp, const AST::MetaItem& mi, const char* loc_str) const;
public:
virtual AttrStage stage() const = 0;
-
+
virtual void handle(const Span& sp, const AST::MetaItem& mi, AST::Crate& crate) const { unexpected(sp, mi, "crate"); }
virtual void handle(const Span& sp, const AST::MetaItem& mi, AST::Crate& crate, const AST::Path& path, AST::Module& mod, AST::Item&i) const { unexpected(sp, mi, "item"); }
// NOTE: To delete, set the type to `_`
@@ -51,7 +51,7 @@ public:
virtual void handle(const Span& sp, const AST::MetaItem& mi, AST::Crate& crate, ::AST::TupleItem& si) const { unexpected(sp, mi, "tuple item"); }
// NOTE: To delete, clear the name
virtual void handle(const Span& sp, const AST::MetaItem& mi, AST::Crate& crate, ::AST::EnumVariant& ev) const { unexpected(sp, mi, "enum variant"); }
-
+
virtual void handle(const Span& sp, const AST::MetaItem& mi, AST::Crate& crate, ::std::unique_ptr<AST::ExprNode>& expr) const { unexpected(sp, mi, "expression"); }
// NOTE: To delete, clear the patterns vector
virtual void handle(const Span& sp, const AST::MetaItem& mi, AST::Crate& crate, ::AST::ExprNode_Match_Arm& expr) const { unexpected(sp, mi, "match arm"); }
diff --git a/src/include/tagged_union.hpp b/src/include/tagged_union.hpp
index 0627b525..bb9c537e 100644
--- a/src/include/tagged_union.hpp
+++ b/src/include/tagged_union.hpp
@@ -19,7 +19,7 @@
#define TU_FIRST(a, ...) a
// Argument iteration
-#define _DISP0(n)
+#define _DISP0(n)
#define _DISP1(n, _1) n _1
#define _DISP2(n, _1, _2) n _1 n _2
#define _DISP3(n, v, v2, v3) n v n v2 n v3
@@ -37,7 +37,7 @@
#define _DISP15(n, a1,a2,a3,a4,a5, b1,b2,b3,b4,b5, c1,c2,c3,c4,c5) _DISP5(n, a1,a2,a3,a4,a5) _DISP5(n, b1,b2,b3,b4,b5) _DISP5(n, c1,c2,c3,c4,c5)
#define _DISP16(n, a1,a2,a3,a4,a5, b1,b2,b3,b4,b5, c1,c2,c3,c4,c5, d1) _DISP5(n, a1,a2,a3,a4,a5) _DISP5(n, b1,b2,b3,b4,b5) _DISP5(n, c1,c2,c3,c4,c5) _DISP1(n, d1)
-#define _DISPO0(n)
+#define _DISPO0(n)
#define _DISPO1(n, _1) n(_1)
#define _DISPO2(n, _1, _2) n(_1) n(_2)
#define _DISPO3(n, v, v2, v3) n(v) n(v2) n(v3)