Commit cb4104e1 authored by Erik Verbruggen's avatar Erik Verbruggen
Browse files

Changed startOffset to point to the start of the scope.

parent 03402a07
......@@ -342,13 +342,18 @@ bool CheckDeclaration::visit(FunctionDefinitionAST *ast)
return false;
}
unsigned funStartOffset = tokenAt(ast->firstToken()).offset;
if (ast->declarator && ast->declarator->core_declarator) {
funStartOffset = tokenAt(ast->declarator->core_declarator->lastToken() - 1).end();
}
Function *fun = funTy->asFunctionType();
fun->setVirtual(ty.isVirtual());
if (ty.isDeprecated())
fun->setDeprecated(true);
if (ty.isUnavailable())
fun->setUnavailable(true);
fun->setStartOffset(tokenAt(ast->firstToken()).offset);
fun->setStartOffset(funStartOffset);
fun->setEndOffset(tokenAt(ast->lastToken() - 1).end());
if (ast->declarator)
fun->setSourceLocation(ast->declarator->firstToken(), translationUnit());
......
......@@ -310,9 +310,13 @@ bool CheckSpecifier::visit(ClassSpecifierAST *ast)
if (ast->name)
sourceLocation = ast->name->firstToken();
unsigned classScopeStart = tokenAt(ast->firstToken()).offset;
if (ast->lbrace_token)
classScopeStart = tokenAt(ast->lbrace_token).end();
const Name *className = semantic()->check(ast->name, _scope);
Class *klass = control()->newClass(sourceLocation, className);
klass->setStartOffset(tokenAt(ast->firstToken()).offset);
klass->setStartOffset(classScopeStart);
klass->setEndOffset(tokenAt(ast->lastToken() - 1).end());
ast->symbol = klass;
unsigned classKey = tokenKind(ast->classkey_token);
......@@ -397,9 +401,13 @@ bool CheckSpecifier::visit(EnumSpecifierAST *ast)
if (ast->name)
sourceLocation = ast->name->firstToken();
unsigned scopeStart = tokenAt(ast->firstToken()).offset;
if (ast->lbrace_token)
scopeStart = tokenAt(ast->lbrace_token).end();
const Name *name = semantic()->check(ast->name, _scope);
Enum *e = control()->newEnum(sourceLocation, name);
e->setStartOffset(tokenAt(ast->firstToken()).offset);
e->setStartOffset(scopeStart);
e->setEndOffset(tokenAt(ast->lastToken() - 1).end());
e->setVisibility(semantic()->currentVisibility());
_scope->enterSymbol(e);
......
......@@ -111,7 +111,7 @@ bool CheckStatement::visit(CaseStatementAST *ast)
bool CheckStatement::visit(CompoundStatementAST *ast)
{
Block *block = control()->newBlock(ast->lbrace_token);
block->setStartOffset(tokenAt(ast->firstToken()).offset);
block->setStartOffset(tokenAt(ast->firstToken()).end());
block->setEndOffset(tokenAt(ast->lastToken() - 1).end());
ast->symbol = block;
_scope->enterSymbol(block);
......
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