Skip to content
Merged
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
76 changes: 12 additions & 64 deletions packages/cxx-frontend/src/AST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5041,31 +5041,6 @@ export class TryBlockStatementAST extends StatementAST {
}
}

/**
* GeneratedLiteralExpressionAST node.
*/
export class GeneratedLiteralExpressionAST extends ExpressionAST {
/**
* Traverse this node using the given visitor.
* @param visitor the visitor.
* @param context the context.
* @returns the result of the visit.
*/
accept<Context, Result>(
visitor: ASTVisitor<Context, Result>,
context: Context,
): Result {
return visitor.visitGeneratedLiteralExpression(this, context);
}

/**
* Returns the location of the literal token in this node
*/
getLiteralToken(): Token | undefined {
return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser);
}
}

/**
* CharLiteralExpressionAST node.
*/
Expand Down Expand Up @@ -7012,9 +6987,9 @@ export class GlobalScopeReflectExpressionAST extends ExpressionAST {
}

/**
* Returns the location of the caret token in this node
* Returns the location of the caretCaret token in this node
*/
getCaretToken(): Token | undefined {
getCaretCaretToken(): Token | undefined {
return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser);
}

Expand Down Expand Up @@ -7044,9 +7019,9 @@ export class NamespaceReflectExpressionAST extends ExpressionAST {
}

/**
* Returns the location of the caret token in this node
* Returns the location of the caretCaret token in this node
*/
getCaretToken(): Token | undefined {
getCaretCaretToken(): Token | undefined {
return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser);
}

Expand Down Expand Up @@ -7084,9 +7059,9 @@ export class TypeIdReflectExpressionAST extends ExpressionAST {
}

/**
* Returns the location of the caret token in this node
* Returns the location of the caretCaret token in this node
*/
getCaretToken(): Token | undefined {
getCaretCaretToken(): Token | undefined {
return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser);
}

Expand Down Expand Up @@ -7119,9 +7094,9 @@ export class ReflectExpressionAST extends ExpressionAST {
}

/**
* Returns the location of the caret token in this node
* Returns the location of the caretCaret token in this node
*/
getCaretToken(): Token | undefined {
getCaretCaretToken(): Token | undefined {
return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser);
}

Expand Down Expand Up @@ -8922,31 +8897,6 @@ export class ConstraintTypeParameterAST extends TemplateParameterAST {
}
}

/**
* GeneratedTypeSpecifierAST node.
*/
export class GeneratedTypeSpecifierAST extends SpecifierAST {
/**
* Traverse this node using the given visitor.
* @param visitor the visitor.
* @param context the context.
* @returns the result of the visit.
*/
accept<Context, Result>(
visitor: ASTVisitor<Context, Result>,
context: Context,
): Result {
return visitor.visitGeneratedTypeSpecifier(this, context);
}

/**
* Returns the location of the type token in this node
*/
getTypeToken(): Token | undefined {
return Token.from(cxx.getASTSlot(this.getHandle(), 0), this.parser);
}
}

/**
* TypedefSpecifierAST node.
*/
Expand Down Expand Up @@ -9461,9 +9411,9 @@ export class SignTypeSpecifierAST extends SpecifierAST {
}

/**
* VaListTypeSpecifierAST node.
* BuiltinTypeSpecifierAST node.
*/
export class VaListTypeSpecifierAST extends SpecifierAST {
export class BuiltinTypeSpecifierAST extends SpecifierAST {
/**
* Traverse this node using the given visitor.
* @param visitor the visitor.
Expand All @@ -9474,7 +9424,7 @@ export class VaListTypeSpecifierAST extends SpecifierAST {
visitor: ASTVisitor<Context, Result>,
context: Context,
): Result {
return visitor.visitVaListTypeSpecifier(this, context);
return visitor.visitBuiltinTypeSpecifier(this, context);
}

/**
Expand Down Expand Up @@ -13404,7 +13354,6 @@ const AST_CONSTRUCTORS: Array<
GotoStatementAST,
DeclarationStatementAST,
TryBlockStatementAST,
GeneratedLiteralExpressionAST,
CharLiteralExpressionAST,
BoolLiteralExpressionAST,
IntLiteralExpressionAST,
Expand Down Expand Up @@ -13475,7 +13424,6 @@ const AST_CONSTRUCTORS: Array<
NonTypeTemplateParameterAST,
TypenameTypeParameterAST,
ConstraintTypeParameterAST,
GeneratedTypeSpecifierAST,
TypedefSpecifierAST,
FriendSpecifierAST,
ConstevalSpecifierAST,
Expand All @@ -13495,7 +13443,7 @@ const AST_CONSTRUCTORS: Array<
VoidTypeSpecifierAST,
SizeTypeSpecifierAST,
SignTypeSpecifierAST,
VaListTypeSpecifierAST,
BuiltinTypeSpecifierAST,
IntegralTypeSpecifierAST,
FloatingPointTypeSpecifierAST,
ComplexTypeSpecifierAST,
Expand Down
4 changes: 1 addition & 3 deletions packages/cxx-frontend/src/ASTKind.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ export enum ASTKind {
TryBlockStatement,

// ExpressionAST
GeneratedLiteralExpression,
CharLiteralExpression,
BoolLiteralExpression,
IntLiteralExpression,
Expand Down Expand Up @@ -183,7 +182,6 @@ export enum ASTKind {
ConstraintTypeParameter,

// SpecifierAST
GeneratedTypeSpecifier,
TypedefSpecifier,
FriendSpecifier,
ConstevalSpecifier,
Expand All @@ -203,7 +201,7 @@ export enum ASTKind {
VoidTypeSpecifier,
SizeTypeSpecifier,
SignTypeSpecifier,
VaListTypeSpecifier,
BuiltinTypeSpecifier,
IntegralTypeSpecifier,
FloatingPointTypeSpecifier,
ComplexTypeSpecifier,
Expand Down
39 changes: 19 additions & 20 deletions packages/cxx-frontend/src/ASTSlot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export enum ASTSlot {
captureDefault = 25,
captureDefaultLoc = 26,
captureList = 27,
caretLoc = 28,
caretCaretLoc = 28,
caseLoc = 29,
castLoc = 30,
catchLoc = 31,
Expand Down Expand Up @@ -240,23 +240,22 @@ export enum ASTSlot {
typeConstraint = 217,
typeId = 218,
typeIdList = 219,
typeLoc = 220,
typeQualifierList = 221,
typeSpecifier = 222,
typeSpecifierList = 223,
typeTraitLoc = 224,
typedefLoc = 225,
typeidLoc = 226,
typenameLoc = 227,
underlyingTypeLoc = 228,
unqualifiedId = 229,
usingDeclaratorList = 230,
usingLoc = 231,
vaArgLoc = 232,
virtualLoc = 233,
virtualOrAccessLoc = 234,
voidLoc = 235,
volatileLoc = 236,
whileLoc = 237,
yieldLoc = 238,
typeQualifierList = 220,
typeSpecifier = 221,
typeSpecifierList = 222,
typeTraitLoc = 223,
typedefLoc = 224,
typeidLoc = 225,
typenameLoc = 226,
underlyingTypeLoc = 227,
unqualifiedId = 228,
usingDeclaratorList = 229,
usingLoc = 230,
vaArgLoc = 231,
virtualLoc = 232,
virtualOrAccessLoc = 233,
voidLoc = 234,
volatileLoc = 235,
whileLoc = 236,
yieldLoc = 237,
}
30 changes: 3 additions & 27 deletions packages/cxx-frontend/src/ASTVisitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -890,18 +890,6 @@ export abstract class ASTVisitor<Context, Result> {
context: Context,
): Result;

/**
* Visit GeneratedLiteralExpression node.
*
* @param node The node to visit.
* @param context The context.
* @returns The result of the visit.
*/
abstract visitGeneratedLiteralExpression(
node: ast.GeneratedLiteralExpressionAST,
context: Context,
): Result;

/**
* Visit CharLiteralExpression node.
*
Expand Down Expand Up @@ -1742,18 +1730,6 @@ export abstract class ASTVisitor<Context, Result> {
context: Context,
): Result;

/**
* Visit GeneratedTypeSpecifier node.
*
* @param node The node to visit.
* @param context The context.
* @returns The result of the visit.
*/
abstract visitGeneratedTypeSpecifier(
node: ast.GeneratedTypeSpecifierAST,
context: Context,
): Result;

/**
* Visit TypedefSpecifier node.
*
Expand Down Expand Up @@ -1983,14 +1959,14 @@ export abstract class ASTVisitor<Context, Result> {
): Result;

/**
* Visit VaListTypeSpecifier node.
* Visit BuiltinTypeSpecifier node.
*
* @param node The node to visit.
* @param context The context.
* @returns The result of the visit.
*/
abstract visitVaListTypeSpecifier(
node: ast.VaListTypeSpecifierAST,
abstract visitBuiltinTypeSpecifier(
node: ast.BuiltinTypeSpecifierAST,
context: Context,
): Result;

Expand Down
28 changes: 3 additions & 25 deletions packages/cxx-frontend/src/RecursiveASTVisitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1038,17 +1038,6 @@ export class RecursiveASTVisitor<Context> extends ASTVisitor<Context, void> {
}
}

/**
* Visit a GeneratedLiteralExpression node.
*
* @param node The node to visit.
* @param context The context.
*/
visitGeneratedLiteralExpression(
node: ast.GeneratedLiteralExpressionAST,
context: Context,
): void {}

/**
* Visit a CharLiteralExpression node.
*
Expand Down Expand Up @@ -1940,17 +1929,6 @@ export class RecursiveASTVisitor<Context> extends ASTVisitor<Context, void> {
this.accept(node.getTypeId(), context);
}

/**
* Visit a GeneratedTypeSpecifier node.
*
* @param node The node to visit.
* @param context The context.
*/
visitGeneratedTypeSpecifier(
node: ast.GeneratedTypeSpecifierAST,
context: Context,
): void {}

/**
* Visit a TypedefSpecifier node.
*
Expand Down Expand Up @@ -2148,13 +2126,13 @@ export class RecursiveASTVisitor<Context> extends ASTVisitor<Context, void> {
): void {}

/**
* Visit a VaListTypeSpecifier node.
* Visit a BuiltinTypeSpecifier node.
*
* @param node The node to visit.
* @param context The context.
*/
visitVaListTypeSpecifier(
node: ast.VaListTypeSpecifierAST,
visitBuiltinTypeSpecifier(
node: ast.BuiltinTypeSpecifierAST,
context: Context,
): void {}

Expand Down
2 changes: 2 additions & 0 deletions packages/cxx-frontend/src/TokenKind.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export enum TokenKind {
BAR_BAR,
BAR_EQUAL,
BAR,
CARET_CARET,
CARET_EQUAL,
CARET,
COLON_COLON,
Expand Down Expand Up @@ -100,6 +101,7 @@ export enum TokenKind {
_NORETURN,
__ATTRIBUTE__,
__BUILTIN_BIT_CAST,
__BUILTIN_META_INFO,
__BUILTIN_OFFSETOF,
__BUILTIN_VA_ARG,
__BUILTIN_VA_LIST,
Expand Down
2 changes: 2 additions & 0 deletions packages/cxx-gen-ast/src/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export const OPERATORS: Array<[kind: string, spelling: string]> = [
["BAR_BAR", "||"],
["BAR_EQUAL", "|="],
["BAR", "|"],
["CARET_CARET", "^^"],
["CARET_EQUAL", "^="],
["CARET", "^"],
["COLON_COLON", "::"],
Expand Down Expand Up @@ -182,6 +183,7 @@ export const CXX_KEYWORDS: string[] = [
"__builtin_offsetof",
"__builtin_va_arg",
"__builtin_va_list",
"__builtin_meta_info",
"__complex__",
"__extension__",
"__float128",
Expand Down
8 changes: 0 additions & 8 deletions src/mlir/cxx/mlir/codegen_expressions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ struct Codegen::ExpressionVisitor {
return type_cast<BoolType>(control()->remove_cv(type));
}

auto operator()(GeneratedLiteralExpressionAST* ast) -> ExpressionResult;
auto operator()(CharLiteralExpressionAST* ast) -> ExpressionResult;
auto operator()(BoolLiteralExpressionAST* ast) -> ExpressionResult;
auto operator()(IntLiteralExpressionAST* ast) -> ExpressionResult;
Expand Down Expand Up @@ -174,13 +173,6 @@ auto Codegen::newPlacement(NewPlacementAST* ast) -> NewPlacementResult {
return {};
}

auto Codegen::ExpressionVisitor::operator()(GeneratedLiteralExpressionAST* ast)
-> ExpressionResult {
auto op =
gen.emitTodoExpr(ast->firstSourceLocation(), to_string(ast->kind()));
return {op};
}

auto Codegen::ExpressionVisitor::operator()(CharLiteralExpressionAST* ast)
-> ExpressionResult {
auto loc = gen.getLocation(ast->literalLoc);
Expand Down
Loading
Loading