This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Collect location of macro definition in the ParsedAST
ClosedPublic

Authored by hokein on Sep 6 2019, 5:08 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

hokein created this revision.Sep 6 2019, 5:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 6 2019, 5:08 AM
hokein retitled this revision from [clangd] Collect location of macro definition in the ParsedAST allows semantic hightlighting macro definition to [clangd] Collect location of macro definition in the ParsedAST.Sep 6 2019, 5:08 AM
hokein edited the summary of this revision. (Show Details)
hokein marked an inline comment as done.
hokein added inline comments.
clang-tools-extra/clangd/ParsedAST.cpp
104 ↗(On Diff #219067)

The name doesn't fit into what it does anymore, maybe rename to CollectMainFileMacroLocations?

Harbormaster completed remote builds in B37840: Diff 219067.
nridge added a subscriber: nridge.Sep 6 2019, 9:06 PM
ilya-biryukov added inline comments.Sep 9 2019, 5:18 AM
clang-tools-extra/clangd/ParsedAST.cpp
104 ↗(On Diff #219067)

Agree, maybe even shorter - CollectMainFileMacros?

clang-tools-extra/clangd/ParsedAST.h
125 ↗(On Diff #219067)

NIT: s/Does not include expansions/Does not include locations?

To avoid confusion, since they are definitions and expansions now.

126 ↗(On Diff #219067)

Could we you rename this to MacroIdentifierLocs? Or something similar not mentioning expansions in the name.

MacroExpLocs could still be interpreted as locations of expansions, rather than locations of all macro identifiers.

clang-tools-extra/clangd/unittests/ParsedASTTests.cpp
234 ↗(On Diff #219067)

We should probably keep the test as is and make sure we also collect inside the preamble.
It's ok to leave a FIXME and do this in a separate change, but let's not change the test to hide the fact that we are not highlighting macros inside the preamble anymore.

hokein updated this revision to Diff 219343.Sep 9 2019, 7:04 AM
hokein marked 4 inline comments as done.

Rename all things.

hokein added a comment.Sep 9 2019, 7:04 AM

Thanks for the suggestions on the new names.

ilya-biryukov accepted this revision.Sep 9 2019, 8:43 AM

LGTM.

We should probably also take a look at highlighting macros inside the preamble part of the main file.
@hokein, are you planning to do this or should we just file a bug for this for now?

clang-tools-extra/clangd/SemanticHighlighting.cpp
38 ↗(On Diff #219343)

NIT: use SourceLocation, it's just an int, so no need to use references here.

This revision is now accepted and ready to land.Sep 9 2019, 8:43 AM
hokein updated this revision to Diff 219501.Sep 10 2019, 2:37 AM
hokein marked an inline comment as done.

address comments

LGTM.

We should probably also take a look at highlighting macros inside the preamble part of the main file.
@hokein, are you planning to do this or should we just file a bug for this for now?

I will file a bug in case we don't forget it.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptSep 10 2019, 3:10 AM