summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/include-fixer
Commit message (Collapse)AuthorAgeFilesLines
...
* include-fixer: Don't overwrite buffer changesManuel Klimek2016-10-251-1/+7
| | | | | | | | | Raise a signal if the buffer has been modified before replacing it, to avoid overwriting users' changes. Patch by Philipp Stephani. llvm-svn: 285060
* Load clang-include-fixer.el from the unit test suite so that the unit tests ↵Manuel Klimek2016-10-251-0/+2
| | | | | | | | can run in batch mode. Patch by Philipp Stephani. llvm-svn: 285059
* Don't copy replacements in for-range loop. NFC.Benjamin Kramer2016-10-191-1/+1
| | | | llvm-svn: 284589
* clang-include-fixer.el: Don't prompt the user about killing ↵Manuel Klimek2016-10-111-0/+2
| | | | | | | | | | | | clang-include-fixer processes By default, Emacs prompts the user when killing processes on exit. This is useful for stateful processes such as interactive shells. However, clang-include-fixer processes are stateless; the only effect of killing them is to cancel a clang-include-fixer operation. Therefore prompting the user is just a nuisance. Patch by Philipp Stephani. Differential Revision: https://reviews.llvm.org/D25378 llvm-svn: 283863
* Make Emacs libraries compatible with Emacs 24.Manuel Klimek2016-10-111-2/+7
| | | | | | | | Emacs 24 doesn't have format-message, fall back to format in that case. Patch by Philipp Stephani. llvm-svn: 283861
* [include-fixer] query-mode should be false by default.Haojian Wu2016-10-101-1/+1
| | | | | | Makes it consistent with documentations. llvm-svn: 283754
* Use `let' instead of `let*' in one place where `let*' isn't necessaryManuel Klimek2016-10-101-3/+3
| | | | | | | | Differential Revision: https://reviews.llvm.org/D25395 Patch by Philipp Stephani. llvm-svn: 283736
* Turn cl::values() (for enum) from a vararg function to using C++ variadic ↵Mehdi Amini2016-10-081-2/+1
| | | | | | | | | | | | | | | template The core of the change is supposed to be NFC, however it also fixes what I believe was an undefined behavior when calling: va_start(ValueArgs, Desc); with Desc being a StringRef. Differential Revision: https://reviews.llvm.org/D25342 llvm-svn: 283671
* Overhaul clang-include-fixer.elHaojian Wu2016-10-052-190/+406
| | | | | | | | | | | | | | | | | | | | | | | | General overhaul to fix many coding bugs, simplify the code, and improve readability. * Clarify documentation strings of user options. * Say that clang-include-fixer-executable is a file to have auto completion. * Allow user to select available options for clang-include-fixer-input-format. Turn it into a symbol as it's not a free-form string. * Remove clang-include-fixer-query-mode. This option was apparently used to select between two different operation modes, which is not a typical use case for user options. Provide two separate commands instead. * Add a face for the overlay highlighting so that users can customize it. Move user commands to the front so that readers of the code aren't buried in internal functions. * Make process calls asynchronous. This is possible here because clang-include-fixer doesn't change files in place. This means input is no longer blocked while clang-include-fixer is running. * Factor out logic in helper functions to keep functions short. * Add comments where appropriate. * Provide an alternative buffer replacement strategy for the case that a single line was inserted (the normal case in the case of clang-include-fixer). This keeps point, markers, and other buffer information intact. * Use let-alist and association lists instead of property lists to shorten the code. * Instead of highlighting only the first occurrence of a symbol, highlight all occurrences and move point to the closest one. * Detect qualified names at point. * Use filepos-to-bufferpos if available. * Formatting. Patch by Philipp Stephani! llvm-svn: 283306
* [include-fixer] Support finding headers for the symbol under cursor.Haojian Wu2016-09-074-12/+98
| | | | | | | | | | | | | | Summary: * Add a `query-symbol` option to query symbol without parsing the source file. * Update Vim & Emacs integration scripts. Reviewers: bkramer, massberg Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D24075 llvm-svn: 280824
* [include-fixer] Fix some Clang-tidy modernize-use-override and Include What ↵Eugene Zelenko2016-09-062-3/+9
| | | | | | | | You Use warnings; other minor fixes. Differential revision: https://reviews.llvm.org/D24179 llvm-svn: 280741
* [include-fixer] Fix an undefined variable exception in vim script when there isHaojian Wu2016-09-011-0/+1
| | | | | | only one candidate header. llvm-svn: 280359
* Revert "Revert "[Include-fixer] Install executables and support scripts""Zachary Turner2016-08-172-3/+25
| | | | | | | | | This reverts commit 2aff596257e1c45fa54baae823ecbe61a785174e. I'm having a bad day apparently. I reverted the wrong CL. This puts it back. llvm-svn: 278978
* Revert "[Include-fixer] Install executables and support scripts"Zachary Turner2016-08-172-25/+3
| | | | | | | | | This reverts commit b725a314a9b7f746c37f70909ec3c4dcb6d9f6b5. The patch that made this test work needed to be reverted, so this test needs to be reverted as well. llvm-svn: 278977
* [Include-fixer] Install executables and support scriptsEugene Zelenko2016-08-172-3/+25
| | | | | | Differential revision: https://reviews.llvm.org/D23045 llvm-svn: 278949
* [include-fixer] Update -help message.Haojian Wu2016-08-171-1/+3
| | | | llvm-svn: 278922
* Fix Wdocumentation unknown parameter warningSimon Pilgrim2016-08-091-1/+1
| | | | llvm-svn: 278111
* [include-fixer] Support processing multiple files in one run.Haojian Wu2016-08-096-67/+95
| | | | | | | | | | | | | | | | | | | Summary: Previously, if we pass multiple files or a file pattern (e.g. /path/to/*.cc) to include-fixer, include-fixer will apply all replacements to the first argument, which probably causes crashes. With this patch, include-fixer can process multiple files now. Vim and Emacs integration are tested manually. Reviewers: bkramer Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D23266 llvm-svn: 278102
* [include-fixer] Correct some header mappings.Haojian Wu2016-08-051-8/+8
| | | | | | | | | | Reviewers: bkramer Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D23199 llvm-svn: 277811
* [include-fixer] Correct nested class search for identifiers with scoped ↵Haojian Wu2016-08-024-11/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | information 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". Reviewers: bkramer Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D23023 llvm-svn: 277442
* Changes related to new implementation of tooling::Replacements as class.Eric Liu2016-08-012-9/+22
| | | | | | | | | | | | Summary: See http://reviews.llvm.org/D21748 for details. Reviewers: djasper, klimek Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D21749 llvm-svn: 277336
* change Vim key binding for include-fixer and clang-renameKirill Bobyrev2016-07-271-3/+3
| | | | | | | | | | | | Change Vim key binding for include-fixer (`,cf` -> `<leader>cf`) and clang-rename (`,cr` -> `<leader>cr`) to use `<leader>` instead of `,` like cool Vim people (tm) do. Reviewers: ioeric Differential Revision: https://reviews.llvm.org/D22854 llvm-svn: 276870
* [clang-include-fixer] Added Emacs integration for clang-include-fixer.Benjamin Kramer2016-07-271-0/+207
| | | | | | | | Patch by Jens Massberg! Thanks a lot. Differential Revision: https://reviews.llvm.org/D22805 llvm-svn: 276853
* [include-fixer] Don't add qualifiers in missing complete type cases.Haojian Wu2016-07-261-3/+6
| | | | | | | | | | | | Summary: In missing complete type cases, we don't know where to add the qualifiers. Reviewers: bkramer Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D22812 llvm-svn: 276761
* [include-fixer] Fix faulty sort predicate.Benjamin Kramer2016-07-221-3/+2
| | | | | | Note the == on the last line, this isn't a strict-weak ordering. llvm-svn: 276400
* [include-fixer] Add mising qualifiers to all instances of an unidentified ↵Haojian Wu2016-07-216-76/+122
| | | | | | | | | | | | symbol. Reviewers: bkramer Subscribers: ioeric, cfe-commits Differential Revision: https://reviews.llvm.org/D22567 llvm-svn: 276280
* [include-fixer] Make error messages a bit prettier and make sure toBenjamin Kramer2016-07-201-2/+4
| | | | | | include a newline at the end. llvm-svn: 276098
* [include-fixer] Tweak: remove unintended const.Haojian Wu2016-07-202-2/+2
| | | | llvm-svn: 276096
* [include-fixer] A refactoring of IncludeFixerContext.Haojian Wu2016-07-195-63/+63
| | | | | | | | | | | | | | | | | Summary: No functional changes in this patch. It is a refactoring (pull out a structure representing the symbol being queried). This is a preparing step for inserting missing namespace qualifiers to all instances of an unidentified symbol. Reviewers: bkramer Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D22510 llvm-svn: 275980
* Unbreak extra tools build post r275882.Benjamin Kramer2016-07-181-0/+1
| | | | llvm-svn: 275886
* [include-fixer] Add an options allow moving the cursor to #include line in vimHaojian Wu2016-07-181-12/+25
| | | | | | | | | | | | | | | | | after inserting a missing header. Summary: A small improvement: Don't print newline character at the end of message, so that users don't have to type ENTER manually after running the python script. Reviewers: bkramer Subscribers: djasper, klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D22351 llvm-svn: 275781
* [include-fixer] Always add as few as possible qualifiers to the unidentified ↵Haojian Wu2016-07-151-8/+30
| | | | | | | | | | | | symbol. Reviewers: bkramer Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D22367 llvm-svn: 275542
* [include-fixer] Correct an incorrecst judgement about prefix scoped qualifiers.Haojian Wu2016-07-141-3/+6
| | | | | | | | | | | | | | | Summary: The judgement that checks whether the fully-qualified name has scoped qualifiers prefix is incorrect. Should always check whether the first matched postion is the beginning position. Reviewers: bkramer Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D22343 llvm-svn: 275386
* [include-fixer] Implement adding missing namespace qualifiers in vim ↵Haojian Wu2016-07-134-74/+162
| | | | | | | | | | | | | | | | | integration. Summary: The patch extends include-fixer's "-output-headers", and "-insert-headers" command line options to make it dump more information (e.g. QualifiedSymbol), so that vim-integration can add missing qualifiers. Reviewers: bkramer Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D22299 llvm-svn: 275279
* Changes related to tooling::applyAllReplacements interface change in D21601.Eric Liu2016-07-113-21/+40
| | | | | | | | | | | | | | | Summary: this patch contains changes related to the interface change from http://reviews.llvm.org/D21601. Only submit this patch after D21601 is submitted. Reviewers: djasper, klimek Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D21602 llvm-svn: 275063
* [include-fixer] Don't add qualifiers to symbols which have global scope ↵Haojian Wu2016-07-082-0/+5
| | | | | | | | | | | | operator. Reviewers: bkramer Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D22127 llvm-svn: 274848
* [include-fixer] Pull out Context implementation code to a cpp file.Haojian Wu2016-07-083-40/+65
| | | | llvm-svn: 274845
* [include-fixer] Add missing namespace qualifiers after inserting a missing ↵Haojian Wu2016-07-087-68/+189
| | | | | | | | | | | | | | | | | | | | | | | header. Summary: This is an initial version of fixing namespace issues by adding missing namespace qualifiers to an unidentified symbol. This version only fixes the first discovered unidentified symbol. In the long run, include-fixer should fix all unidentified symbols with a same name at one run. Currently, it works on command-line tool. The vim integration is not implemented yet. Reviewers: klimek, bkramer, djasper Subscribers: bkramer, ioeric, cfe-commits Differential Revision: http://reviews.llvm.org/D21603 llvm-svn: 274832
* [clang-include-fixer] fix PEP8 warningsBenjamin Kramer2016-07-041-9/+11
| | | | | | | | | | This fixes PEP8 E231, E225, E226, E302 warnings. Patch by Kirill Bobyrev! Differential revision: http://reviews.llvm.org/D21974 llvm-svn: 274511
* [include-fixer] reduce stack size by changing RegexHeaderMap to use const ↵Eric Liu2016-07-041-2/+1
| | | | | | char * pair. llvm-svn: 274501
* Fix broken build caused by r274494.Eric Liu2016-07-041-0/+1
| | | | llvm-svn: 274495
* [include-fixer] make HeaderMapCollector maps from regex instead of postfix.Eric Liu2016-07-046-651/+654
| | | | | | | | | | | | | | Summary: this enables us to map a group of headers to one header name, e.g. headers from one directory can be mapped to the same header. Reviewers: bkramer Subscribers: cfe-commits, hokein Differential Revision: http://reviews.llvm.org/D21787 llvm-svn: 274494
* [include-fixer] Correct two wrong header mappings.Haojian Wu2016-06-151-2/+2
| | | | | | | | | | Reviewers: bkramer Subscribers: ioeric, cfe-commits Differential Revision: http://reviews.llvm.org/D21371 llvm-svn: 272773
* [include-fixer] remove redundant code.Eric Liu2016-06-141-2/+1
| | | | llvm-svn: 272657
* [include-fixer] only deduplicate symbols after matching symbols with the ↵Eric Liu2016-06-131-13/+17
| | | | | | | | | | | | | | | | | | undefined identifier. 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
* [include-fixer] give users an option to show N more headers in case there ↵Eric Liu2016-06-101-4/+15
| | | | | | | | | | | | | | are too many candidates. 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
* [include-fixer] do not index friend function declaration.Eric Liu2016-06-091-3/+8
| | | | | | | | | | | | | | | 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
* [include-fixer] Keep dot dot in SymbolInfo file paths.Haojian Wu2016-06-082-3/+2
| | | | | | | | | | | | | | | | | | 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
* [include-fixer] do not add enum forward declaration into symbol index table.Eric Liu2016-06-081-4/+4
| | | | llvm-svn: 272132
* [include-fixer] try to make vim header selection more friendly.Eric Liu2016-06-071-20/+35
| | | | | | | | | | | | 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
OpenPOWER on IntegriCloud