Skip to content

Commit

Permalink
Improve comment and outline
Browse files Browse the repository at this point in the history
  • Loading branch information
MaskRay committed Jul 25, 2018
1 parent 03aa024 commit 122eda1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion index_tests/macros/complex.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ FOO(make1(), make2);
"storage": 0,
"declarations": ["12:1-12:20|0|1|1"],
"spell": "12:1-12:20|0|1|2",
"extent": "1:1-1:1|0|1|0",
"extent": "12:1-12:20|0|1|0",
"bases": [],
"derived": [],
"vars": [],
Expand Down
2 changes: 1 addition & 1 deletion index_tests/macros/foo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ int x = A;
"storage": 0,
"declarations": [],
"spell": "5:12-5:15|15041163540773201510|2|1026",
"extent": "1:1-1:1|15041163540773201510|2|0",
"extent": "5:12-5:15|15041163540773201510|2|0",
"bases": [],
"derived": [],
"vars": [],
Expand Down
2 changes: 1 addition & 1 deletion index_tests/multi_file/funky_enum.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

A,
B,
C
C
13 changes: 10 additions & 3 deletions src/indexer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,10 @@ class IndexDataConsumer : public index::IndexDataConsumer {
p++;
if (p < E && *p == ' ')
p++;
pad = int(p - begin);
if (p + 1 == q)
p++;
else
pad = int(p - begin);
} else {
// Other lines, skip |pad| bytes
int prefix = pad;
Expand Down Expand Up @@ -614,9 +617,13 @@ class IndexDataConsumer : public index::IndexDataConsumer {
auto do_def_decl = [&](auto *entity) {
if (is_def) {
entity->def.spell = GetUse(db, loc, SemDC, role);
SourceRange R = OrigD->getSourceRange();
entity->def.extent =
GetUse(db, FromTokenRange(SM, Lang, OrigD->getSourceRange()), LexDC,
Role::None);
GetUse(db,
R.getBegin().isFileID()
? FromTokenRange(SM, Lang, OrigD->getSourceRange())
: loc,
LexDC, Role::None);
} else if (is_decl) {
entity->declarations.push_back(GetUse(db, loc, LexDC, role));
} else {
Expand Down

0 comments on commit 122eda1

Please sign in to comment.