[PATCH] D23023: [include-fixer] Correct nested class search for identifiers with scoped information

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 1 11:39:10 PDT 2016


hokein created this revision.
hokein added a reviewer: bkramer.
hokein added a subscriber: cfe-commits.

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".

https://reviews.llvm.org/D23023

Files:
  include-fixer/IncludeFixer.cpp
  include-fixer/IncludeFixerContext.cpp
  include-fixer/SymbolIndexManager.cpp
  include-fixer/SymbolIndexManager.h
  unittests/include-fixer/IncludeFixerTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23023.66347.patch
Type: text/x-patch
Size: 6165 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160801/393fdf9d/attachment.bin>


More information about the cfe-commits mailing list