summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/include-fixer
Commit message (Collapse)AuthorAgeFilesLines
...
* [include-fixer] Be smarter about inserting symbols for a prefix.Benjamin Kramer2016-06-031-0/+12
| | | | | | | | | | | | | | | | | | | | | | 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
* [include-fixer] Don't add missing header if the unindentified symbol isn't ↵Haojian Wu2016-06-031-0/+23
| | | | | | | | | | | | | | | | from the main file. 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
* [include-fixer] fixed a wrong header mapping.Eric Liu2016-06-031-1/+1
| | | | llvm-svn: 271638
* [include-fixer] added GNU symbols hardcoded header mapping.Eric Liu2016-06-031-26/+316
| | | | | | | | | | | | Summary: [include-fixer] added GNU symbols hardcoded header mapping. Reviewers: klimek, bkramer Subscribers: cfe-commits, hokein Differential Revision: http://reviews.llvm.org/D20902 llvm-svn: 271637
* [include-fixer] use includer of .inc header to be the file path of a symbol ↵Eric Liu2016-06-015-22/+88
| | | | | | | | | | | | | | from .inc header. 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
* [include-fixer] Use YAML format in -output-headers and -insert-header mode.Haojian Wu2016-06-014-28/+75
| | | | | | | | | | | | | | | 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
* [find-all-symbols] remove dots in SymbolInfo file paths.Eric Liu2016-05-312-2/+9
| | | | | | | | | | | | Summary: remove dots in SymbolInfo file paths. Reviewers: bkramer, klimek Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D20819 llvm-svn: 271302
* [include-fixer] removed unused forward declaration.Eric Liu2016-05-311-2/+0
| | | | llvm-svn: 271294
* [include-fixer] use clang-format cleaner to insert header.Eric Liu2016-05-314-131/+12
| | | | | | | | | | | | Summary: clang-format's cleanupAroundReplacements() takes care of header insertions. Reviewers: bkramer Subscribers: cfe-commits, hokein Differential Revision: http://reviews.llvm.org/D20816 llvm-svn: 271287
* [include-fixer] Inline trivial methods.Benjamin Kramer2016-05-312-20/+8
| | | | | | | Putting them into the .cpp file is both more verbose and slower than having them in the header. No functional change intended. llvm-svn: 271285
* [include-fixer] Use a DenseMap, order doesn't matter here.Benjamin Kramer2016-05-311-1/+2
| | | | llvm-svn: 271284
* [include-fixer] Rank symbols based on the number of occurrences we found ↵Benjamin Kramer2016-05-312-3/+36
| | | | | | | | | | | | | while merging. 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
* [include-fixer] use tooling::Replacements since the order of replacements ↵Eric Liu2016-05-313-14/+7
| | | | | | | | | | don't matter anymore. 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
* [include-fixer] Code cleanup.Haojian Wu2016-05-312-59/+62
| | | | | | | | | | | | | | 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
* [include-fixer] collect the number of times a symbols is found in an ↵Eric Liu2016-05-313-6/+26
| | | | | | | | | | | | | | | | indexing run and use it for symbols popularity ranking. 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
* Make the vim integration output a bit prettier and drop the -debug flag.Benjamin Kramer2016-05-311-4/+4
| | | | llvm-svn: 271266
* [include-fixer] Add missing dependency.Haojian Wu2016-05-311-0/+1
| | | | llvm-svn: 271261
* [include-fixer] Create a mode in vim integration to show multiple potential ↵Haojian Wu2016-05-315-100/+246
| | | | | | | | | | | | | | | | | | | headers. 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
* [include-fixer] Add a missing .h.Benjamin Kramer2016-05-271-1/+1
| | | | llvm-svn: 270989
* [include-fixer] /usr/include/xlocal.h to include/xlocal.h in hardcoded map.Eric Liu2016-05-251-1/+1
| | | | llvm-svn: 270703
* Include local header with quotes instead of angle brackets.Benjamin Kramer2016-05-251-1/+1
| | | | | | This works by accident because we pass '-I.' llvm-svn: 270701
* [include-fixer] Simplify the code since we won't handle multiple includes at ↵Haojian Wu2016-05-251-32/+12
| | | | | | | | | | | | once. Reviewers: bkramer Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D20581 llvm-svn: 270700
* [include-fixer] moved STLPostfixMap into findAllSymbols library and make it ↵Eric Liu2016-05-256-364/+364
| | | | | | | | | | | | | | a static variable in function. 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
* [include-fixer][find-all-symbols] added missing dependencies.Eric Liu2016-05-241-0/+2
| | | | llvm-svn: 270578
* [include-fixer][find-all-symbols] removed unused const member from ↵Eric Liu2016-05-241-2/+0
| | | | | | YamlReporter to fix build bot failure. llvm-svn: 270571
* [find-all-symbols] Added hardcode header mapping from header postfix to ↵Eric Liu2016-05-2411-56/+551
| | | | | | | | | | | | | | header name for STL symbols. Summary: [find-all-symbols] Added hardcode header mapping from header postfix to header name for STL symbols. Reviewers: klimek, bkramer Subscribers: cfe-commits, hokein Differential Revision: http://reviews.llvm.org/D20566 llvm-svn: 270566
* [find-all-symbol] Ignore inline namespace context.Haojian Wu2016-05-201-3/+3
| | | | | | | | | | Reviewers: bkramer Subscribers: cfe-commits, ioeric Differential Revision: http://reviews.llvm.org/D20465 llvm-svn: 270206
* [find-all-symbols] fix failing unittest for Windows build bot.Eric Liu2016-05-201-3/+2
| | | | llvm-svn: 270202
* [find-all-symbols] fixed FindAllMacros compilation error.Eric Liu2016-05-201-1/+1
| | | | llvm-svn: 270196
* [find-all-symbols] make HeaderMapCollector optional in FindAllSymbols and ↵Eric Liu2016-05-205-18/+21
| | | | | | FindAllMacros. llvm-svn: 270193
* [find-all-symbol] Add macro support.Haojian Wu2016-05-209-18/+141
| | | | | | | | | | Reviewers: bkramer Subscribers: cfe-commits, ioeric Differential Revision: http://reviews.llvm.org/D20420 llvm-svn: 270189
* [include-fixer] Fix unused variable warning in Release builds.Benjamin Kramer2016-05-191-4/+5
| | | | llvm-svn: 270082
* [include-fixer] Remove an unused local variable ExistingHeaders.Haojian Wu2016-05-191-2/+0
| | | | llvm-svn: 270059
* [include-fixer] Make search handle fully qualified names correctly.Benjamin Kramer2016-05-191-0/+11
| | | | | | | | | 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
* [include-fixer] Sort headers after inserting new headers.Eric Liu2016-05-195-36/+93
| | | | | | | | | | | | Summary: [include-fixer] Sort headers after inserting new headers. Reviewers: bkramer Subscribers: klimek, djasper, hokein, cfe-commits Differential Revision: http://reviews.llvm.org/D20370 llvm-svn: 270031
* [include-fixer] Also look up prefixes of queries.Benjamin Kramer2016-05-181-40/+48
| | | | | | | | | | | | 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
* [clang-include-fixer] Added Vim integration for clang-include-fixer.Eric Liu2016-05-182-0/+103
| | | | | | | | | | | | Summary: [clang-include-fixer] Added Vim integration for clang-include-fixer. Reviewers: hokein, bkramer Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D20329 llvm-svn: 269927
* [include-fixer] Don't insert #includes if a fatal error occurred.Benjamin Kramer2016-05-182-3/+12
| | | | | | | | | 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
* [include-fixer] Ignore non-scoped enum declaration during search.Haojian Wu2016-05-181-4/+10
| | | | | | | | | | Reviewers: bkramer Subscribers: cfe-commits, ioeric Differential Revision: http://reviews.llvm.org/D20354 llvm-svn: 269890
* findAllSymbols: Prune unused libdeps.NAKAMURA Takumi2016-05-181-3/+0
| | | | llvm-svn: 269875
* include-fixer: They require clangLex.NAKAMURA Takumi2016-05-182-0/+2
| | | | llvm-svn: 269873
* [find-all-symbols] Add IWYU private pragma support.Haojian Wu2016-05-177-11/+171
| | | | | | | | | | Reviewers: djasper, klimek Subscribers: kimgr, cfe-commits, bkramer, ioeric Differential Revision: http://reviews.llvm.org/D19816 llvm-svn: 269779
* [find-all-symbols] Ignore anonymous enum declarations.Haojian Wu2016-05-171-0/+3
| | | | llvm-svn: 269762
* [include-fixer] Make the "extend to the right" hack support typos without ↵Benjamin Kramer2016-05-171-6/+16
| | | | | | | | nested names in the front. This handles cases where the initial namespace is unknown. llvm-svn: 269758
* [include-fixer] Fix broken dependency shared buildEtienne Bergeron2016-05-132-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The shared build is broken (again). To repro: [Release + Shared] ``` -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON ``` Errors: ``` tools/clang/tools/extra/include-fixer/tool/CMakeFiles/clang-include-fixer.dir/ClangIncludeFixer.cpp.o: In function `(anonymous namespace)::includeFixerMain(int, char const**)': ClangIncludeFixer.cpp:(.text._ZN12_GLOBAL__N_116includeFixerMainEiPPKc+0xbe9): undefined reference to `clang::find_all_symbols::SymbolInfo::SymbolInfo(llvm::StringRef, clang::find_all_symbols::SymbolInfo::SymbolKind, llvm::StringRef, int, std::vector<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::string>, std::allocator<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::string> > > const&)' collect2: error: ld returned 1 exit status ``` ``` tools/clang/tools/extra/unittests/include-fixer/CMakeFiles/IncludeFixerTests.dir/IncludeFixerTest.cpp.o: In function `clang::include_fixer::(anonymous namespace)::runIncludeFixer(llvm::StringRef, std::vector<std::string, std::allocator<std::string> > const&)': IncludeFixerTest.cpp:(.text._ZN5clang13include_fixer12_GLOBAL__N_1L15runIncludeFixerEN4llvm9StringRefERKSt6vectorISsSaISsEE+0x10e): undefined reference to `clang::find_all_symbols::SymbolInfo::SymbolInfo(llvm::StringRef, clang::find_all_symbols::SymbolInfo::SymbolKind, llvm::StringRef, int, std::vector<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::string>, std::allocator<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::string> > > const&)' IncludeFixerTest.cpp:(.text._ZN5clang13include_fixer12_GLOBAL__N_1L15runIncludeFixerEN4llvm9StringRefERKSt6vectorISsSaISsEE+0x1dc): undefined reference to `clang::find_all_symbols::SymbolInfo::SymbolInfo(llvm::StringRef, clang::find_all_symbols::SymbolInfo::SymbolKind, llvm::StringRef, int, std::vector<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::string>, std::allocator<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::string> > > const&)' IncludeFixerTest.cpp:(.text._ZN5clang13include_fixer12_GLOBAL__N_1L15runIncludeFixerEN4llvm9StringRefERKSt6vectorISsSaISsEE+0x2f3): undefined reference to `clang::find_all_symbols::SymbolInfo::SymbolInfo(llvm::StringRef, clang::find_all_symbols::SymbolInfo::SymbolKind, llvm::StringRef, int, std::vector<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::string>, std::allocator<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::string> > > const&)' IncludeFixerTest.cpp:(.text._ZN5clang13include_fixer12_GLOBAL__N_1L15runIncludeFixerEN4llvm9StringRefERKSt6vectorISsSaISsEE+0x40e): undefined reference to `clang::find_all_symbols::SymbolInfo::SymbolInfo(llvm::StringRef, clang::find_all_symbols::SymbolInfo::SymbolKind, llvm::StringRef, int, std::vector<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::string>, std::allocator<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::string> > > const&)' IncludeFixerTest.cpp:(.text._ZN5clang13include_fixer12_GLOBAL__N_1L15runIncludeFixerEN4llvm9StringRefERKSt6vectorISsSaISsEE+0x526): undefined reference to `clang::find_all_symbols::SymbolInfo::SymbolInfo(llvm::StringRef, clang::find_all_symbols::SymbolInfo::SymbolKind, llvm::StringRef, int, std::vector<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::string>, std::allocator<std::pair<clang::find_all_symbols::SymbolInfo::ContextType, std::string> > > const&)' ``` Reviewers: bkramer, hokein Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D20245 llvm-svn: 269441
* [include-fixer] Use scope contexts information to improve query.Haojian Wu2016-05-132-12/+40
| | | | | | | | | | Reviewers: bkramer Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D20205 llvm-svn: 269430
* [include-fixer] Simplify unittest code.Haojian Wu2016-05-136-28/+14
| | | | | | | | | | | | | | | Summary: The InMemorySymbolIndex only constructs hard-coded Class symbols from a string map. The patch provide a flexable way in InMemorySymbolIndex to create a custom SymbolInfo in the include-fixer unittest. Reviewers: bkramer Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D20232 llvm-svn: 269427
* [find-all-symbols] Add EnumDecl type in YAML traits.Haojian Wu2016-05-131-0/+1
| | | | llvm-svn: 269422
* [include-fixer] Rename XrefsDB to SymbolIndex.Benjamin Kramer2016-05-1312-80/+84
| | | | | | It's not really containing xrefs so the name didn't fit. No functional change. llvm-svn: 269403
* [find-all-symbols] Add enum type support.Haojian Wu2016-05-134-15/+55
| | | | | | | | | | | | | | Summary: Also change enums defined in SymbolInfo to scoped enums to avoid conflicts. Reviewers: bkramer Subscribers: cfe-commits, ioeric Differential Revision: http://reviews.llvm.org/D20203 llvm-svn: 269401
OpenPOWER on IntegriCloud