summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/unittests
Commit message (Collapse)AuthorAgeFilesLines
...
* [change-namepsace] make it possible to whitelist symbols so they don't get ↵Eric Liu2017-02-241-1/+2
| | | | | | | | | | | | | | updated. Reviewers: hokein Reviewed By: hokein Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D30328 llvm-svn: 296110
* [clang-tidy] Reword the "code outside header guard" warning.Benjamin Kramer2017-02-211-59/+89
| | | | | | | | | | | | The check doesn't really know if the code it is warning about came before or after the header guard, so phrase it more neutral instead of complaining about code before the header guard. The location for the warning is still not optimal, but I don't think fixing that is worth the effort, the preprocessor doesn't give us a better location. Differential Revision: https://reviews.llvm.org/D30191 llvm-svn: 295715
* Fix clang-move test after clang-format update r295312Krasimir Georgiev2017-02-161-3/+3
| | | | llvm-svn: 295317
* [clang-tidy] Ignore spaces between globs in the Checks option.Alexander Kornienko2017-02-161-1/+1
| | | | llvm-svn: 295303
* [change-namespace] fix unscoped enum constant references.Eric Liu2017-02-021-0/+201
| | | | | | | | | | Reviewers: bkramer Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D29460 llvm-svn: 293909
* [change-namespace] check using shadow decl correctly when shortening ↵Eric Liu2017-02-021-1/+69
| | | | | | | | | | | | | | | | | namespace specifiers. Summary: This fixes mismatch between template decls and template specialization decls. Also added a few more test cases. Reviewers: bkramer Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D29447 llvm-svn: 293897
* [change-namespace] correctly shorten namespace when references have leading '::'Eric Liu2017-01-261-0/+39
| | | | | | | | | | Reviewers: bkramer Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D29182 llvm-svn: 293187
* [change-namespace] add leading '::' to references in new namespace when name ↵Eric Liu2017-01-261-0/+68
| | | | | | | | | | | | | | | | | | conflict is possible. Summary: For example, when we change 'na' to "nb::nc", we need to add leading '::' to references "::nc::X" in the changed namespace. Reviewers: bkramer Reviewed By: bkramer Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D29176 llvm-svn: 293182
* [clang-move] Dump enum and type alias declarations.Haojian Wu2017-01-161-13/+11
| | | | | | | | | | Reviewers: ioeric Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28293 llvm-svn: 292098
* Remove unused lambda captures. NFCMalcolm Parsons2017-01-131-2/+2
| | | | llvm-svn: 291941
* Correctly classify main file includes if there is a prefix addedAlexander Kornienko2017-01-121-0/+83
| | | | | | | | | | | | | | | | | Summary: Prevents misclassifying includes based on the command-line filename (e.g. if a project is in a subdirectory). This is slightly more robust than the additional duplicate detection, however the current classification scheme is still kind of brittle for a lot of code. Reviewers: hokein, alexfh Subscribers: cfe-commits, #clang-tools-extra Patch by Julian Bangert! Differential Revision: https://reviews.llvm.org/D26015 llvm-svn: 291767
* [find-all-symbols] Index partial template specializations.Haojian Wu2017-01-111-0/+22
| | | | | | | | | | | | | | | Summary: Fix no std::function index. Previously, we don't index all the template specialization declarations of functions and classes (Because we assume that template functions/classes are indexed by their template declarations), but this is not always true in some cases like `std::function` which only has a partial template specialization declaration. Reviewers: ioeric, bkramer Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D27920 llvm-svn: 291669
* [include-fixer] Load symbol index asynchronously.Benjamin Kramer2017-01-091-2/+3
| | | | | | | | We don't actually need the index until parse time, so fetch it in the background and start parsing. By the time it is actually needed it's likely that the loading phase has completed in the background. llvm-svn: 291446
* [clang-move] Support moving type alias declarations.Haojian Wu2017-01-041-19/+0
| | | | | | | | | | Reviewers: ioeric Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28279 llvm-svn: 290967
* [change-namespace] get newlines around moved namespace right.Eric Liu2017-01-041-3/+42
| | | | | | | | | | | | Summary: Previously, a `\n` might be left in the old namespace and thus not copied to the new namespace, which is bad. Reviewers: hokein Subscribers: alexshap, cfe-commits Differential Revision: https://reviews.llvm.org/D28282 llvm-svn: 290966
* [clang-move] Support moving enum declarations.Haojian Wu2017-01-031-1/+0
| | | | | | | | | | Reviewers: ioeric Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28228 llvm-svn: 290891
* [clang-move] Only move used helper declarations.Haojian Wu2017-01-031-2/+19
| | | | | | | | | | | | | | | | | Summary: Instead of moving all the helper declarations blindly, this patch implements an AST-based call graph solution to make clang-move only move used helper decls to new.cc and remove unused decls in old.cc. Depends on D27674. Reviewers: ioeric Subscribers: mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D27673 llvm-svn: 290873
* [change-namespace] consider namespace aliases to shorten qualified names.Eric Liu2016-12-231-0/+108
| | | | | | | | | | Reviewers: hokein Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28052 llvm-svn: 290421
* [change-namespace] do not fix calls to overloaded operator functions.Eric Liu2016-12-201-0/+41
| | | | | | | | | | | | Summary: Also make sure one function reference is only processed once. Reviewers: hokein Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D27982 llvm-svn: 290176
* [include-fixer] Desugar incomplete types.Benjamin Kramer2016-12-161-0/+4
| | | | | | | | This will look through typedefs so include-fixer will look up the target of the typedef instead of the typedef itself (which is already in scope). llvm-svn: 289952
* [change-namespace] fix a case references to templated using alias are ↵Eric Liu2016-12-151-0/+12
| | | | | | qualified types. llvm-svn: 289816
* [change-namespace] handling templated type aliases correctly.Eric Liu2016-12-151-0/+82
| | | | | | | | | | | | Summary: This fixes templated type aliases and templated type aliases in classes. Reviewers: hokein Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D27801 llvm-svn: 289799
* modernize-use-auto NFC fixesPiotr Padlewski2016-12-143-5/+3
| | | | llvm-svn: 289656
* Remove deprecated methods ast_matchers::BoundNodes::{getStmtAs,getDeclAs}Alexander Kornienko2016-12-131-1/+1
| | | | llvm-svn: 289542
* [clang-move] Fix incorrect EndLoc for declarations in macros.Haojian Wu2016-12-131-0/+18
| | | | | | | | | | Reviewers: ioeric Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D27713 llvm-svn: 289541
* [change-namespace] always add a '::' prefix when a symbol reference needs to ↵Eric Liu2016-12-071-30/+113
| | | | | | be fully-qualified. llvm-svn: 288969
* [change-namespace] don't fix using shadow decls in classes.Eric Liu2016-12-071-0/+30
| | | | | | | | | | | | | | Summary: Using shadow declarations in classes always refers to base class, which does not need to be fixed/qualified since it can be inferred from inheritance. Reviewers: bkramer Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D27523 llvm-svn: 288919
* [change-namespace] move template class forward-declarations and don't move ↵Eric Liu2016-12-071-0/+54
| | | | | | | | | | | | | | | | | | fwd-decls in classes. Summary: Forward declarations in moved namespaces should be moved back to the old namespaces. We should also move template class forward declarations. Also fix a bug that moves forward declarations of nested classes. Reviewers: bkramer Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D27515 llvm-svn: 288908
* [clang-move] ignore unsupported symbol kinds when checking if all symbols ↵Eric Liu2016-12-061-3/+20
| | | | | | are moved. llvm-svn: 288791
* [change-namespace] get changing namespace to global correct.Eric Liu2016-12-051-0/+36
| | | | llvm-svn: 288662
* Fix a buildbot failure in include-fixer.Eric Liu2016-12-021-7/+4
| | | | llvm-svn: 288495
* [change-namespace] fix non-calling function references.Eric Liu2016-11-291-0/+34
| | | | | | | | | | Reviewers: hokein Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D27208 llvm-svn: 288139
* ClangMoveTests.cpp: Fix a bogus comparison of iterator.NAKAMURA Takumi2016-11-281-1/+2
| | | | | | msc Debug build detected it. llvm-svn: 288034
* [clang-move] Enable dump all declarations in old header.Haojian Wu2016-11-241-14/+77
| | | | | | | | | | | | | | | | | | | Summary: * Add -dump_dels option to dump all declarations from old header. It will allow clang-move used as a frontend to get declarations from header. Further more, this will make debugging stuff easier. Currently only class/function types are supported. * Refactoring code a little bit by creating a ClangMoveContext which holds all options for ClangMoveTool, which can simplify the code in some degree. Reviewers: ioeric Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D27059 llvm-svn: 287863
* [clang-move] Add some options allowing to add old/new.h to new/old.h ↵Haojian Wu2016-11-231-0/+48
| | | | | | | | | | | | | | | | respectively. Summary: * --new_depend_on_old: new header will include old header * --old_depend_on_new: old header will include new header. Reviewers: ioeric Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26966 llvm-svn: 287752
* [change-namespace] handle constructor initializer: Derived : Base::Base() {} ↵Eric Liu2016-11-161-19/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | and added conflict detections Summary: namespace nx { namespace ny { class Base { public: Base(i) {}} } } namespace na { namespace nb { class X : public nx::ny { public: X() : Base::Base(1) {} }; } } When changing from na::nb to x::y, "Base::Base" will be changed to "nx::ny::Base" and "Base::" in "Base::Base" will be replaced with "nx::ny::Base" too, which causes conflict. This conflict should've been detected when adding replacements but was hidden by `addOrMergeReplacement`. We now also detect conflict when adding replacements where conflict must not happen. The namespace lookup is tricky here, we simply replace "Base::Base()" with "nx::ny::Base()" as a workaround, which compiles but not perfect. Reviewers: hokein Subscribers: bkramer, cfe-commits Differential Revision: https://reviews.llvm.org/D26637 llvm-svn: 287118
* [clang-move] Make the output code look more pretty.Haojian Wu2016-11-151-6/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Add decent blank lines between declarations: * Add extra blank line after #define or #includes. * Add extra blank line between declarations. * Add extra blank line in front of #endif. Previously, the new generated code is quite tight: ``` #ifndef FOO_H #define FOO_H namespace a { class A { public: int f(); }; int A::f() { return 0; } } // namespace a #endif // FOO_H ``` After this patch, the code looks like: ``` #ifndef FOO_H #define FOO_H namespace a { class A { public: int f(); }; int A::f() { return 0; } } // namespace a #endif // FOO_H ``` Reviewers: ioeric Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26493 llvm-svn: 286943
* [change-namespace] consider typedef/using alias decls in the moved namespace.Eric Liu2016-11-141-6/+70
| | | | | | | | | | | | Summary: If a TypeLoc refers to a type alias defined in the moved namespace, we do not need to update its specifier since the type alias decl will be moved along with the type reference. Reviewers: hokein Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26592 llvm-svn: 286873
* [clang-move] Fix an incorrect range for the functions whose returned value ↵Haojian Wu2016-11-141-0/+18
| | | | | | | | | | | | | | | | | | | is a macro Summary: Fix an incorrect range for the functions whose returned value is a macro (e.g. `bool`). This incorrect range can lead to modifications of an unexpected file where the macro is in. We should use expansion location instead of spelling location. Reviewers: ioeric Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26609 llvm-svn: 286833
* Handle adding new nested namespace in old namespace.Eric Liu2016-11-101-0/+42
| | | | | | | | | | Reviewers: hokein Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26456 llvm-svn: 286486
* [change-namespace] shorten namespace qualifier based on UsingDecl and ↵Eric Liu2016-11-081-83/+357
| | | | | | | | | | | | | | | | | UsingDirectiveDecl. Summary: when replacing symbol references in moved namespaces, trying to make the replace name as short as possible by considering UsingDecl (i.e. UsingShadow) and UsingDirectiveDecl (i.e. using namespace decl). Reviewers: hokein Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25771 llvm-svn: 286307
* [clang-move] Move all code from old.h/cc directly when moving all class ↵Haojian Wu2016-11-081-6/+80
| | | | | | | | | | | | | | declarations from old.h. Summary: When moving all code to new.h/cc, these code also will be formatted based on the given code style. Reviewers: ioeric Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26236 llvm-svn: 286281
* [change-namespace] fix namespace specifiers of template arguments.Eric Liu2016-10-311-0/+41
| | | | llvm-svn: 285549
* [clang-move] Support moving template class forward declarations.Haojian Wu2016-10-211-0/+3
| | | | llvm-svn: 284859
* Fix signed/unsigned comparison warningsSimon Pilgrim2016-10-182-2/+2
| | | | llvm-svn: 284476
* Fix windows buildbot error.Haojian Wu2016-10-172-4/+5
| | | | llvm-svn: 284370
* Recommit "[ClangTidy] Add UsingInserter and NamespaceAliaser"Haojian Wu2016-10-173-0/+240
| | | | | | | | | | | | | | Summary: This adds helper classes to add using declaractions and namespace aliases to function bodies. These help making function calls to deeply nested functions concise (e.g. when calling helpers in a refactoring) Patch by Julian Bangert! Reviewers: alexfh, hokein Subscribers: beanz, mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D24997 llvm-svn: 284368
* ClangMoveTests.cpp: Appease msc18.NAKAMURA Takumi2016-10-171-4/+4
| | | | | | | | | | | | | | | clang-tools-extra\unittests\clang-move\ClangMoveTests.cpp(216) : error C2593: 'operator =' is ambiguous llvm\include\llvm/ADT/SmallVector.h(898): could be 'const llvm::SmallVector<std::string,4> &llvm::SmallVector<std::string,4>::operator =(std::initializer_list<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>)' llvm\include\llvm/ADT/SmallVector.h(893): or 'const llvm::SmallVector<std::string,4> &llvm::SmallVector<std::string,4>::operator =(llvm::SmallVectorImpl<T> &&)' with [ T=std::string ] llvm\include\llvm/ADT/SmallVector.h(883): or 'const llvm::SmallVector<std::string,4> &llvm::SmallVector<std::string,4>::operator =(llvm::SmallVector<std::string,4> &&)' llvm\include\llvm/ADT/SmallVector.h(873): or 'const llvm::SmallVector<std::string,4> &llvm::SmallVector<std::string,4>::operator =(const llvm::SmallVector<std::string,4> &)' while trying to match the argument list '(llvm::SmallVector<std::string,4>, initializer-list)' llvm-svn: 284360
* Reformat.NAKAMURA Takumi2016-10-171-4/+4
| | | | llvm-svn: 284359
* [clang-move] Use cl::list for the list of namesAlexander Shaposhnikov2016-10-141-4/+4
| | | | | | | | | | This diff replaces manual parsing of the comma-separated list of names with cl::list and cl::CommaSeparated. Test plan: make -j8 check-clang-tools Differential revision: https://reviews.llvm.org/D25586 llvm-svn: 284291
OpenPOWER on IntegriCloud