Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: "v22.1.8"
rev: "v23.1.0"
hooks:
- id: clang-format

Expand Down
8 changes: 4 additions & 4 deletions generator/parser/ast.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@
****************************************************************************/

#ifndef AST_H
#define AST_H
#define AST_H

#include "smallobject.h"
#include "list.h"
#include "smallobject.h"
#include "list.h"

class QString;

#define DECLARE_AST_NODE(k) enum { __node_kind = Kind_##k };
#define DECLARE_AST_NODE(k) enum { __node_kind = Kind_##k };

class TokenStream;

Expand Down
12 changes: 6 additions & 6 deletions generator/parser/binder.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@
****************************************************************************/

#ifndef BINDER_H
#define BINDER_H
#define BINDER_H

#include "default_visitor.h"
#include "codemodel.h"
#include "type_compiler.h"
#include "name_compiler.h"
#include "declarator_compiler.h"
#include "default_visitor.h"
#include "codemodel.h"
#include "type_compiler.h"
#include "name_compiler.h"
#include "declarator_compiler.h"

class TokenStream;
class LocationManager;
Expand Down
12 changes: 6 additions & 6 deletions generator/parser/class_compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@
****************************************************************************/

#ifndef CLASS_COMPILER_H
#define CLASS_COMPILER_H
#define CLASS_COMPILER_H

#include <QtCore/qglobal.h>
#include <QtCore/QStringList>
#include <QtCore/qglobal.h>
#include <QtCore/QStringList>

#include "default_visitor.h"
#include "name_compiler.h"
#include "type_compiler.h"
#include "default_visitor.h"
#include "name_compiler.h"
#include "type_compiler.h"

class TokenStream;
class Binder;
Expand Down
20 changes: 10 additions & 10 deletions generator/parser/codemodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,19 @@
****************************************************************************/

#ifndef CODEMODEL_H
#define CODEMODEL_H
#define CODEMODEL_H

#include "codemodel_fwd.h"
#include "codemodel_fwd.h"

#include <QtCore/QHash>
#include <QtCore/QList>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QVector>
#include <QtCore/QSet>
#include <QSharedPointer>
#include <QtCore/QHash>
#include <QtCore/QList>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QVector>
#include <QtCore/QSet>
#include <QSharedPointer>

#define DECLARE_MODEL_NODE(k) enum { __node_kind = Kind_##k };
#define DECLARE_MODEL_NODE(k) enum { __node_kind = Kind_##k };

class CodeModel
{
Expand Down
8 changes: 4 additions & 4 deletions generator/parser/codemodel_finder.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@
****************************************************************************/

#ifndef CODEMODEL_FINDER_H
#define CODEMODEL_FINDER_H
#define CODEMODEL_FINDER_H

#include "default_visitor.h"
#include "codemodel_fwd.h"
#include "name_compiler.h"
#include "default_visitor.h"
#include "codemodel_fwd.h"
#include "name_compiler.h"

class TokenStream;
class Binder;
Expand Down
6 changes: 3 additions & 3 deletions generator/parser/compiler_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@
****************************************************************************/

#ifndef COMPILER_UTILS_H
#define COMPILER_UTILS_H
#define COMPILER_UTILS_H

#include <utility>
#include <utility>

#include "codemodel.h"
#include "codemodel.h"

class QString;
struct TypeSpecifierAST;
Expand Down
8 changes: 4 additions & 4 deletions generator/parser/control.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@
****************************************************************************/

#ifndef CONTROL_H
#define CONTROL_H
#define CONTROL_H

#include "symbol.h"
#include "smallobject.h"
#include "symbol.h"
#include "smallobject.h"

#include <QtCore/QHash>
#include <QtCore/QHash>

struct Declarator;
struct Type;
Expand Down
10 changes: 5 additions & 5 deletions generator/parser/declarator_compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@
****************************************************************************/

#ifndef DECLARATOR_COMPILER_H
#define DECLARATOR_COMPILER_H
#define DECLARATOR_COMPILER_H

#include "default_visitor.h"
#include "codemodel.h"
#include "default_visitor.h"
#include "codemodel.h"

#include <QtCore/QString>
#include <QtCore/QList>
#include <QtCore/QString>
#include <QtCore/QList>

class TokenStream;
class Binder;
Expand Down
4 changes: 2 additions & 2 deletions generator/parser/default_visitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
****************************************************************************/

#ifndef DEFAULT_VISITOR_H
#define DEFAULT_VISITOR_H
#define DEFAULT_VISITOR_H

#include "visitor.h"
#include "visitor.h"

class DefaultVisitor : public Visitor
{
Expand Down
4 changes: 2 additions & 2 deletions generator/parser/dumptree.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
****************************************************************************/

#ifndef DUMPTREE_H
#define DUMPTREE_H
#define DUMPTREE_H

#include "default_visitor.h"
#include "default_visitor.h"

class DumpTree : protected DefaultVisitor
{
Expand Down
10 changes: 5 additions & 5 deletions generator/parser/lexer.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@
****************************************************************************/

#ifndef LEXER_H
#define LEXER_H
#define LEXER_H

#include "symbol.h"
#include "symbol.h"

#include <QtCore/QString>
#include <cstdlib>
#include <cassert>
#include <QtCore/QString>
#include <cstdlib>
#include <cassert>

struct NameSymbol;
class Lexer;
Expand Down
4 changes: 2 additions & 2 deletions generator/parser/list.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
****************************************************************************/

#ifndef FASTLIST_H
#define FASTLIST_H
#define FASTLIST_H

#include "smallobject.h"
#include "smallobject.h"

template<typename Tp>
struct ListNode {
Expand Down
6 changes: 3 additions & 3 deletions generator/parser/name_compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
****************************************************************************/

#ifndef NAME_COMPILER_H
#define NAME_COMPILER_H
#define NAME_COMPILER_H

#include "default_visitor.h"
#include <QtCore/QStringList>
#include "default_visitor.h"
#include <QtCore/QStringList>

class TokenStream;
class Binder;
Expand Down
34 changes: 17 additions & 17 deletions generator/parser/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1351,29 +1351,29 @@ bool Parser::parseAbstractDeclarator(DeclaratorAST*& node)
}

label1:
{
bool isVector = true;
{
bool isVector = true;

while (token_stream.lookAhead() == '[') {
nextToken();
while (token_stream.lookAhead() == '[') {
nextToken();

ExpressionAST* expr = 0;
parseCommaExpression(expr);
ExpressionAST* expr = 0;
parseCommaExpression(expr);

ADVANCE(']', "]");
ADVANCE(']', "]");

ast->array_dimensions = snoc(ast->array_dimensions, expr, _M_pool);
isVector = true;
}
ast->array_dimensions = snoc(ast->array_dimensions, expr, _M_pool);
isVector = true;
}

int tok = token_stream.lookAhead();
if (ast->sub_declarator && !(isVector || tok == '(' || tok == ',' || tok == ';' || tok == '=')) {
rewind(start);
return false;
}
int tok = token_stream.lookAhead();
if (ast->sub_declarator && !(isVector || tok == '(' || tok == ',' || tok == ';' || tok == '=')) {
rewind(start);
return false;
}

parseDeclaratorParametersAndSuffix(ast);
}
parseDeclaratorParametersAndSuffix(ast);
}

update_pos:
if (token_stream.cursor() == start)
Expand Down
8 changes: 4 additions & 4 deletions generator/parser/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@
****************************************************************************/

#ifndef PARSER_H
#define PARSER_H
#define PARSER_H

#include "ast.h"
#include "lexer.h"
#include "ast.h"
#include "lexer.h"

#include <QtCore/QString>
#include <QtCore/QString>

class FileSymbol;
class Control;
Expand Down
14 changes: 7 additions & 7 deletions generator/parser/rxx_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@
****************************************************************************/

#ifndef RXX_ALLOCATOR_H
#define RXX_ALLOCATOR_H
#define RXX_ALLOCATOR_H

#include <cstddef>
#include <cstdlib>
#include <cstring>
#include <memory>
#include <cstddef>
#include <cstdlib>
#include <cstring>
#include <memory>

template<class _Tp>
class rxx_allocator
Expand Down Expand Up @@ -92,9 +92,9 @@ class rxx_allocator

_M_current_block = _M_storage[_M_block_index] = reinterpret_cast<char*>(new char[_S_block_size]);

#if defined(RXX_ALLOCATOR_INIT_0) // ### make it a policy
#if defined(RXX_ALLOCATOR_INIT_0) // ### make it a policy
::memset(_M_current_block, 0, _S_block_size);
#endif
#endif
_M_current_index = 0;
}

Expand Down
6 changes: 3 additions & 3 deletions generator/parser/smallobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
****************************************************************************/

#ifndef SMALLOBJECT_H
#define SMALLOBJECT_H
#define SMALLOBJECT_H

#include "rxx_allocator.h"
#include <cstring>
#include "rxx_allocator.h"
#include <cstring>

class pool
{
Expand Down
10 changes: 5 additions & 5 deletions generator/parser/symbol.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@
****************************************************************************/

#ifndef SYMBOL_H
#define SYMBOL_H
#define SYMBOL_H

#include <QtCore/QString>
#include <cstring>
#include <QtCore/QString>
#include <cstring>

#include <QtCore/QHash>
#include <QtCore/QPair>
#include <QtCore/QHash>
#include <QtCore/QPair>

struct NameSymbol {
const char* data;
Expand Down
2 changes: 1 addition & 1 deletion generator/parser/tokens.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
****************************************************************************/

#ifndef TOKENS_H
#define TOKENS_H
#define TOKENS_H

enum TOKEN_KIND {
Token_EOF = 0,
Expand Down
10 changes: 5 additions & 5 deletions generator/parser/type_compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@
****************************************************************************/

#ifndef TYPE_COMPILER_H
#define TYPE_COMPILER_H
#define TYPE_COMPILER_H

#include "default_visitor.h"
#include "default_visitor.h"

#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QList>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QList>

class TokenStream;
class Binder;
Expand Down
Loading
Loading