Summary:
we should only deduplicate symbols after matching symbols with the
undefined identifier. This patch tries to fix the situation where matching
symbols are deleted when it has the same header as a non-matching symbol, which
can prevent finding the correct header even if there is a matched symbol.
Reviewers: bkramer
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D21290
llvm-svn: 272576
Summary: give users an option to show N more headers in case there are too many candidates.
Reviewers: bkramer
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D21181
llvm-svn: 272387
Summary:
we want to exclude friend declaration, but the `DeclContext` of a
friend function declaration is not the class in which it is declared, so we need
to explicitly check if the parent is a `friendDecl`.
Reviewers: bkramer
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D21175
llvm-svn: 272261
Summary:
Currently, removing dot dot in header's path doesn't make include-fixer
minimize path correctly in some cases, for example, specify a relative search
path based on the build directory("-I../include/").
Besides, removing dot dot can break symbolic link directories. So don't
removing it for now.
Reviewers: ioeric, bkramer
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D21132
llvm-svn: 272152
Summary: use 'input()' to get user's input so that we can support more options.
Reviewers: hokein, bkramer
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D21019
llvm-svn: 272004
If prefix search finds something where nothing can be nested under (e.g.
a variable or macro) don't add it to the result.
This is for cases like:
header.h:
extern int a;
file.cc:
namespace a {
SOME_MACRO
}
We will look up a::SOME_MACRO, which doesn't have any results. Then we
look up 'a' and find something before we ever look up just 'SOME_MACRO'.
With some basic filtering we can avoid this case.
Differential Revision: http://reviews.llvm.org/D20960
llvm-svn: 271671
Summary:
The further solution is to add the missing header to the file where the
symbol comes from.
Reviewers: bkramer
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D20950
llvm-svn: 271660
Summary: added PathConfig.cpp and use includer of .inc header to be the file path of a symbol from .inc header.
Reviewers: bkramer
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D20855
llvm-svn: 271385
Summary:
And some improvements:
* Show better error messages on unfound symbols.
* Fix a typo.
Reviewers: bkramer
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D20827
llvm-svn: 271382
This sorts based on the popularity of the header, not the symbol. If
there are mutliple matching symbols in one header we take the maximum
popularity for that header and deduplicate. If we know nothing we sort
lexicographically based on the header path.
Differential Revision: http://reviews.llvm.org/D20814
llvm-svn: 271283
Summary: [include-fixer] use tooling::Replacements since the order of replacements don't matter anymore.
Differential Revision: http://reviews.llvm.org/D20813
llvm-svn: 271279
Summary:
* Abstract the DB setting code to a function.
* Remove the unused FallbackStyle.
Reviewers: bkramer
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D20808
llvm-svn: 271273
Summary:
[include-fixer] collect the number of times a symbols is found in an
indexing run and use it for symbols popularity ranking.
Reviewers: bkramer
Subscribers: cfe-commits, hokein, djasper
Differential Revision: http://reviews.llvm.org/D20804
llvm-svn: 271268
Summary:
Some changes in the patch:
* Add two commandline flags in clang-include-fixer.
* Introduce a IncludeFixerContext for the queried symbol.
* Pull out CreateReplacementsForHeader.
Reviewers: bkramer
Subscribers: klimek, cfe-commits, ioeric
Differential Revision: http://reviews.llvm.org/D20621
llvm-svn: 271258
Summary: [include-fixer] moved STLPostfixMap into findAllSymbols library and make it a static variable in function.
Reviewers: bkramer
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D20619
llvm-svn: 270696
If a search string starts with "::" we don't want to return any results
for suffixes of that string.
Differential Revision: http://reviews.llvm.org/D20424
llvm-svn: 270055
This is used to find nested classes. For a nested name foo::bar::qux we
will first look up foo::bar::qux, then foo::bar, then foo unless we find
a result. This is used to support nested classes which are not part of
the index but can only be used if the header for the parent context is
included.
Differential Revision: http://reviews.llvm.org/D20372
llvm-svn: 269956
This typically happens when the user didn't setup include paths correctly
and the fixer starts adding garbage includes. Avoid that. Disable the error
limit though, as we might hit that easily with missing includes and still
want to fix those cases.
llvm-svn: 269923