This is an archive of the discontinued LLVM Phabricator instance.

[include-fixer] Correct nested class search for identifiers with scoped information
ClosedPublic

Authored by hokein on Aug 1 2016, 11:39 AM.

Details

Summary

include-fixer will firstly try to use scoped namespace context information to
search identifier. However, in some cases, it's unsafe to do nested class
search, because it might treat the identifier as a nested class of scoped
namespace.

Given the following code, and the symbol database only has two classes: "foo" and
"b::Bar".

namespace foo { Bar t; }

Before getting fixing, include-fixer will never search "Bar" symbol.
Because it firstly tries to search "foo::Bar", there is no "Bar" in foo namespace,
then it finds "foo" in database finally. So it treats "Bar" is a nested class
of "foo".

Diff Detail

Repository
rL LLVM

Event Timeline

hokein updated this revision to Diff 66347.Aug 1 2016, 11:39 AM
hokein retitled this revision from to [include-fixer] Correct nested class search for identifiers with scoped information.
hokein updated this object.
hokein added a reviewer: bkramer.
hokein added a subscriber: cfe-commits.
bkramer accepted this revision.Aug 2 2016, 1:57 AM
bkramer edited edge metadata.
bkramer added inline comments.
include-fixer/SymbolIndexManager.h
32 ↗(On Diff #66347)

"tries to strip"

35 ↗(On Diff #66347)

"fails to find"

This revision is now accepted and ready to land.Aug 2 2016, 1:57 AM
hokein updated this revision to Diff 66452.Aug 2 2016, 3:36 AM
hokein edited edge metadata.

Address review comments.

This revision was automatically updated to reflect the committed changes.