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
353 changes: 177 additions & 176 deletions packages/cxx-frontend/src/ASTSlot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,180 +82,181 @@ export enum ASTSlot {
decltypeSpecifier = 59,
defaultLoc = 60,
deleteLoc = 61,
designatorList = 62,
doLoc = 63,
dotLoc = 64,
ellipsisLoc = 65,
elseLoc = 66,
elseStatement = 67,
emicolonLoc = 68,
enumLoc = 69,
enumTypeSpecifier = 70,
enumeratorList = 71,
equalLoc = 72,
exceptionDeclaration = 73,
exceptionSpecifier = 74,
exclaimLoc = 75,
explicitLoc = 76,
explicitSpecifier = 77,
exportLoc = 78,
expression = 79,
expressionList = 80,
externLoc = 81,
extraAttributeList = 82,
finalLoc = 83,
foldOp = 84,
foldOpLoc = 85,
forLoc = 86,
friendLoc = 87,
functionBody = 88,
genericAssociationList = 89,
genericLoc = 90,
globalModuleFragment = 91,
gnuAtributeList = 92,
gnuAttributeList = 93,
gotoLabelList = 94,
gotoLoc = 95,
greaterLoc = 96,
handlerList = 97,
headerLoc = 98,
id = 99,
idExpression = 100,
identifier = 101,
identifierLoc = 102,
ifLoc = 103,
iffalseExpression = 104,
iftrueExpression = 105,
importLoc = 106,
importName = 107,
indexExpression = 108,
initDeclaratorList = 109,
initializer = 110,
inlineLoc = 111,
inputOperandList = 112,
isFinal = 113,
isIndirect = 114,
isInline = 115,
isNot = 116,
isOverride = 117,
isPack = 118,
isPure = 119,
isTemplateIntroduced = 120,
isThisIntroduced = 121,
isTrue = 122,
isVariadic = 123,
isVirtual = 124,
lambdaSpecifierList = 125,
lbraceLoc = 126,
lbracket2Loc = 127,
lbracketLoc = 128,
leftExpression = 129,
lessLoc = 130,
literal = 131,
literalLoc = 132,
literalOperatorId = 133,
lparen2Loc = 134,
lparenLoc = 135,
matchedAssocIndex = 136,
memInitializerList = 137,
minusGreaterLoc = 138,
moduleDeclaration = 139,
moduleLoc = 140,
moduleName = 141,
modulePartition = 142,
moduleQualifier = 143,
mutableLoc = 144,
namespaceLoc = 145,
nestedNameSpecifier = 146,
nestedNamespaceSpecifierList = 147,
newInitalizer = 148,
newLoc = 149,
newPlacement = 150,
noexceptLoc = 151,
noreturnLoc = 152,
offsetofLoc = 153,
op = 154,
opLoc = 155,
openLoc = 156,
operatorFunctionId = 157,
operatorLoc = 158,
otherVirtualOrAccessLoc = 159,
outputOperandList = 160,
parameterDeclarationClause = 161,
parameterDeclarationList = 162,
privateLoc = 163,
privateModuleFragment = 164,
ptrOpList = 165,
qualifier = 166,
qualifierLoc = 167,
questionLoc = 168,
rangeDeclaration = 169,
rangeInitializer = 170,
rbraceLoc = 171,
rbracket2Loc = 172,
rbracketLoc = 173,
refLoc = 174,
refOp = 175,
refQualifierLoc = 176,
registerLoc = 177,
requirementList = 178,
requiresClause = 179,
requiresLoc = 180,
restrictLoc = 181,
returnLoc = 182,
rightExpression = 183,
rparen2Loc = 184,
rparenLoc = 185,
scopeLoc = 186,
secondColonLoc = 187,
semicolonLoc = 188,
sizeExpression = 189,
sizeofLoc = 190,
specifier = 191,
specifierLoc = 192,
splicer = 193,
starLoc = 194,
statement = 195,
statementList = 196,
staticAssertLoc = 197,
staticLoc = 198,
stringLiteral = 199,
stringliteralLoc = 200,
switchLoc = 201,
symbolicName = 202,
symbolicNameLoc = 203,
templateArgumentList = 204,
templateId = 205,
templateLoc = 206,
templateParameterList = 207,
templateRequiresClause = 208,
thisLoc = 209,
threadLoc = 210,
threadLocalLoc = 211,
throwLoc = 212,
tildeLoc = 213,
trailingReturnType = 214,
tryLoc = 215,
typeConstraint = 216,
typeId = 217,
typeIdList = 218,
typeLoc = 219,
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,
depth = 62,
designatorList = 63,
doLoc = 64,
dotLoc = 65,
ellipsisLoc = 66,
elseLoc = 67,
elseStatement = 68,
emicolonLoc = 69,
enumLoc = 70,
enumTypeSpecifier = 71,
enumeratorList = 72,
equalLoc = 73,
exceptionDeclaration = 74,
exceptionSpecifier = 75,
exclaimLoc = 76,
explicitLoc = 77,
explicitSpecifier = 78,
exportLoc = 79,
expression = 80,
expressionList = 81,
externLoc = 82,
extraAttributeList = 83,
finalLoc = 84,
foldOp = 85,
foldOpLoc = 86,
forLoc = 87,
friendLoc = 88,
functionBody = 89,
genericAssociationList = 90,
genericLoc = 91,
globalModuleFragment = 92,
gnuAtributeList = 93,
gnuAttributeList = 94,
gotoLabelList = 95,
gotoLoc = 96,
greaterLoc = 97,
handlerList = 98,
headerLoc = 99,
id = 100,
idExpression = 101,
identifier = 102,
identifierLoc = 103,
ifLoc = 104,
iffalseExpression = 105,
iftrueExpression = 106,
importLoc = 107,
importName = 108,
indexExpression = 109,
initDeclaratorList = 110,
initializer = 111,
inlineLoc = 112,
inputOperandList = 113,
isFinal = 114,
isIndirect = 115,
isInline = 116,
isNot = 117,
isOverride = 118,
isPack = 119,
isPure = 120,
isTemplateIntroduced = 121,
isThisIntroduced = 122,
isTrue = 123,
isVariadic = 124,
isVirtual = 125,
lambdaSpecifierList = 126,
lbraceLoc = 127,
lbracket2Loc = 128,
lbracketLoc = 129,
leftExpression = 130,
lessLoc = 131,
literal = 132,
literalLoc = 133,
literalOperatorId = 134,
lparen2Loc = 135,
lparenLoc = 136,
matchedAssocIndex = 137,
memInitializerList = 138,
minusGreaterLoc = 139,
moduleDeclaration = 140,
moduleLoc = 141,
moduleName = 142,
modulePartition = 143,
moduleQualifier = 144,
mutableLoc = 145,
namespaceLoc = 146,
nestedNameSpecifier = 147,
nestedNamespaceSpecifierList = 148,
newInitalizer = 149,
newLoc = 150,
newPlacement = 151,
noexceptLoc = 152,
noreturnLoc = 153,
offsetofLoc = 154,
op = 155,
opLoc = 156,
openLoc = 157,
operatorFunctionId = 158,
operatorLoc = 159,
otherVirtualOrAccessLoc = 160,
outputOperandList = 161,
parameterDeclarationClause = 162,
parameterDeclarationList = 163,
privateLoc = 164,
privateModuleFragment = 165,
ptrOpList = 166,
qualifier = 167,
qualifierLoc = 168,
questionLoc = 169,
rangeDeclaration = 170,
rangeInitializer = 171,
rbraceLoc = 172,
rbracket2Loc = 173,
rbracketLoc = 174,
refLoc = 175,
refOp = 176,
refQualifierLoc = 177,
registerLoc = 178,
requirementList = 179,
requiresClause = 180,
requiresLoc = 181,
restrictLoc = 182,
returnLoc = 183,
rightExpression = 184,
rparen2Loc = 185,
rparenLoc = 186,
scopeLoc = 187,
secondColonLoc = 188,
semicolonLoc = 189,
sizeExpression = 190,
sizeofLoc = 191,
specifier = 192,
specifierLoc = 193,
splicer = 194,
starLoc = 195,
statement = 196,
statementList = 197,
staticAssertLoc = 198,
staticLoc = 199,
stringLiteral = 200,
stringliteralLoc = 201,
switchLoc = 202,
symbolicName = 203,
symbolicNameLoc = 204,
templateArgumentList = 205,
templateId = 206,
templateLoc = 207,
templateParameterList = 208,
templateRequiresClause = 209,
thisLoc = 210,
threadLoc = 211,
threadLocalLoc = 212,
throwLoc = 213,
tildeLoc = 214,
trailingReturnType = 215,
tryLoc = 216,
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,
}
4 changes: 2 additions & 2 deletions src/frontend/cxx/frontend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,9 @@ void Frontend::Private::preparePreprocessor() {

void Frontend::Private::parse() {
unit_->parse(ParserConfiguration{
.checkTypes = cli.opt_fcheck || unit_->language() == LanguageKind::kC,
.checkTypes =
cli.opt_fcheck || needsIR() || unit_->language() == LanguageKind::kC,
.fuzzyTemplateResolution = true,
.reflect = !cli.opt_fno_reflect,
});

if (cli.opt_freport_missing_types) {
Expand Down
1 change: 0 additions & 1 deletion src/lsp/cxx/lsp/cxx_document.cc
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@ void CxxDocument::parse(std::string source) {
unit.parse(ParserConfiguration{
.checkTypes = cli.opt_fcheck,
.fuzzyTemplateResolution = true,
.reflect = !cli.opt_fno_reflect,
.stopParsingPredicate = stopParsingPredicate,
.complete = complete,
});
Expand Down
1 change: 1 addition & 0 deletions src/parser/cxx/ast.h
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ class TemplateDeclarationAST final : public DeclarationAST {
RequiresClauseAST* requiresClause = nullptr;
DeclarationAST* declaration = nullptr;
TemplateParametersSymbol* symbol = nullptr;
int depth = 0;

void accept(ASTVisitor* visitor) override { visitor->visit(this); }

Expand Down
4 changes: 4 additions & 0 deletions src/parser/cxx/ast_printer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,10 @@ void ASTPrinter::visit(FunctionDefinitionAST* ast) {

void ASTPrinter::visit(TemplateDeclarationAST* ast) {
out_ << std::format("{}\n", "template-declaration");
++indent_;
out_ << std::format("{:{}}", "", indent_ * 2);
out_ << std::format("depth: {}\n", ast->depth);
--indent_;
if (ast->templateParameterList) {
++indent_;
out_ << std::format("{:{}}", "", indent_ * 2);
Expand Down
Loading
Loading