This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] NFC refactor lexer-utils to be usable without ASTContext
ClosedPublic

Authored by JonasToth on Sep 29 2018, 4:48 AM.

Details

Summary

This patch is a small refactoring necessary for
'readability-isolate-declaration' and does not introduce functional changes.
It allows to use the utility functions without a full ASTContext and requires only the SourceManager and the LangOpts.

Diff Detail

Repository
rL LLVM

Event Timeline

JonasToth created this revision.Sep 29 2018, 4:48 AM
JonasToth added a project: Restricted Project.Sep 29 2018, 4:49 AM
JonasToth updated this revision to Diff 167592.Sep 29 2018, 5:13 AM
  • fix missing file
alexfh requested changes to this revision.Oct 1 2018, 5:12 AM

So far the change doesn't look really helpful. Are you going to use the function from code where no ASTContext is available? Can you give an example?

This revision now requires changes to proceed.Oct 1 2018, 5:12 AM

This patch is related to https://reviews.llvm.org/D51949

To isolate variable declarations (split int * p, v; up) it is necessary to do a lot of work with source location and requires some forward and backwards lexing. The functions there just use the LangOpts and the SourceManager and don't have a ASTContext available, that why I changed this interface.

alexfh accepted this revision.Oct 5 2018, 7:09 AM

This patch is related to https://reviews.llvm.org/D51949

To isolate variable declarations (split int * p, v; up) it is necessary to do a lot of work with source location and requires some forward and backwards lexing. The functions there just use the LangOpts and the SourceManager and don't have a ASTContext available, that why I changed this interface.

Makes sense. But then I'd change "to be easier to use" to "to be callable without ASTContext" or something similar in the patch description.

Otherwise LG.

This revision is now accepted and ready to land.Oct 5 2018, 7:09 AM
JonasToth retitled this revision from [clang-tidy] NFC refactor lexer-utils slightly to be easier to use to [clang-tidy] NFC refactor lexer-utils to be usable without ASTContext.Oct 5 2018, 7:15 AM
JonasToth edited the summary of this revision. (Show Details)
This revision was automatically updated to reflect the committed changes.