summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/change-namespace
Commit message (Collapse)AuthorAgeFilesLines
* Rename directory housing clang-change-namespace to be eponymousNico Weber2019-03-155-1439/+0
| | | | | | | | | Makes the name of this directory consistent with the names of the other directories in clang-tools-extra. Differential Revision: https://reviews.llvm.org/D59382 llvm-svn: 356254
* Fix file headers. NFCFangrui Song2019-03-011-1/+1
| | | | llvm-svn: 355188
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-193-12/+9
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Add explicit dependency on clangSerialization after rC348911Fangrui Song2018-12-122-0/+2
| | | | llvm-svn: 348916
* A bit of AST matcher cleanup, NFC.Alexander Kornienko2018-11-251-9/+8
| | | | | | | | | Removed the uses of the allOf() matcher inside node matchers that are implicit allOf(). Replaced uses of allOf() with the explicit node matcher where it makes matchers more readable. Replace anyOf(hasName(), hasName(), ...) with the more efficient and readable hasAnyName(). llvm-svn: 347520
* [change-namespace] Enhance detection of conflicting namespaces.Eric Liu2018-10-221-11/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: For example: ``` namespace util { class Base; } namespace new { namespace util { class Internal; } } namespace old { util::Base b1; } ``` When changing `old::` to `new::`, `util::` in namespace "new::" will conflict with "new::util::" unless a leading "::" is added. Reviewers: hokein Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D53489 llvm-svn: 344897
* Port getLocEnd -> getEndLocStephen Kelly2018-08-091-2/+2
| | | | | | | | Subscribers: nemanjai, ioeric, kbarton, cfe-commits Differential Revision: https://reviews.llvm.org/D50355 llvm-svn: 339401
* Port getLocStart -> getBeginLocStephen Kelly2018-08-091-6/+6
| | | | | | | | | | Reviewers: javed.absar Subscribers: nemanjai, kbarton, ilya-biryukov, ioeric, jkorous, arphaman, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D50354 llvm-svn: 339400
* Replace hardcoded format styles in a few tools with the default style in ↵Eric Liu2018-08-021-1/+2
| | | | | | libFormat. llvm-svn: 338696
* [change-namespace] Don't match a function call/ref multiple times.Eric Liu2018-03-151-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Previously, the matcher matches a function call/ref multiple times, one for each decl ancestor. This might cause problems. For example, in the following case, `func()` would be matched once (with namespace context) before using decl is seen and once after using decl is seeing, which would result in different conflicting replacements as the first match would replace `func` with "ns::func" as it doesn't know about the using decl. ``` namespace x { namespace { using ::ns::func; void f() { func(); } } } ``` Switching from `hasDescendant` matching to `hasAncestor` matching solves the problem. Reviewers: hokein Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D44517 llvm-svn: 327629
* [change-namespace] Fix crash when injected base-class name is used in friend ↵Eric Liu2017-12-081-0/+4
| | | | | | | | | | | | declarations. Reviewers: hokein Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D41001 llvm-svn: 320139
* [CMake] Use PRIVATE in target_link_libraries for executablesShoaib Meenai2017-12-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We currently use target_link_libraries without an explicit scope specifier (INTERFACE, PRIVATE or PUBLIC) when linking executables. Dependencies added in this way apply to both the target and its dependencies, i.e. they become part of the executable's link interface and are transitive. Transitive dependencies generally don't make sense for executables, since you wouldn't normally be linking against an executable. This also causes issues for generating install export files when using LLVM_DISTRIBUTION_COMPONENTS. For example, clang has a lot of LLVM library dependencies, which are currently added as interface dependencies. If clang is in the distribution components but the LLVM libraries it depends on aren't (which is a perfectly legitimate use case if the LLVM libraries are being built static and there are therefore no run-time dependencies on them), CMake will complain about the LLVM libraries not being in export set when attempting to generate the install export file for clang. This is reasonable behavior on CMake's part, and the right thing is for LLVM's build system to explicitly use PRIVATE dependencies for executables. Unfortunately, CMake doesn't allow you to mix and match the keyword and non-keyword target_link_libraries signatures for a single target; i.e., if a single call to target_link_libraries for a particular target uses one of the INTERFACE, PRIVATE, or PUBLIC keywords, all other calls must also be updated to use those keywords. This means we must do this change in a single shot. I also fully expect to have missed some instances; I tested by enabling all the projects in the monorepo (except dragonegg), and configuring both with and without shared libraries, on both Darwin and Linux, but I'm planning to rely on the buildbots for other configurations (since it should be pretty easy to fix those). Even after this change, we still have a lot of target_link_libraries calls that don't specify a scope keyword, mostly for shared libraries. I'm thinking about addressing those in a follow-up, but that's a separate change IMO. Differential Revision: https://reviews.llvm.org/D40823 llvm-svn: 319840
* [change-namespace] do not change type locs in defaulted functions.Eric Liu2017-10-161-1/+3
| | | | | | | | | | Reviewers: hokein Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D38893 llvm-svn: 315892
* [change-namespace] avoid adding leading '::' when possible.Eric Liu2017-03-211-17/+38
| | | | | | | | | | | | | | | | | | | | Summary: When changing namespaces, the tool adds leading "::" to references that need to be fully-qualified, which would affect readability. We avoid adding "::" when the symbol name does not conflict with the new namespace name. For example, a symbol name "na::nb::X" conflicts with "ns::na" since it would be resolved to "ns::na::nb::X" in the new namespace. Reviewers: hokein Reviewed By: hokein Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D30493 llvm-svn: 298363
* [change-namespace] do not rename specialized template parameters.Eric Liu2017-03-171-0/+11
| | | | | | | | | | Reviewers: hokein Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D31076 llvm-svn: 298090
* [change-namespace] get insertion points of forward declarations correct.Eric Liu2017-03-011-9/+9
| | | | | | | | | | | | | | | | Summary: Previously, the insertion points would conflict with the old namespace deletion. Reviewers: hokein Reviewed By: hokein Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D30490 llvm-svn: 296604
* [change-namespace] trying to fix windows buildbot failure.Eric Liu2017-02-281-2/+5
| | | | llvm-svn: 296458
* [change-namespace] fix asan failure in r296110.Eric Liu2017-02-241-8/+9
| | | | llvm-svn: 296113
* [change-namepsace] make it possible to whitelist symbols so they don't get ↵Eric Liu2017-02-243-1/+39
| | | | | | | | | | | | | | updated. Reviewers: hokein Reviewed By: hokein Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D30328 llvm-svn: 296110
* [change-namespace] add an option to dump changed files in YAML.Eric Liu2017-02-132-3/+36
| | | | | | | | | | | | Reviewers: hokein Reviewed By: hokein Subscribers: fhahn, cfe-commits Differential Revision: https://reviews.llvm.org/D29893 llvm-svn: 294969
* [change-namespace] trying to fix build bot failure caused by r293909.Eric Liu2017-02-021-0/+2
| | | | llvm-svn: 293927
* [change-namespace] fix unscoped enum constant references.Eric Liu2017-02-021-0/+30
| | | | | | | | | | 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/+2
| | | | | | | | | | | | | | | | | 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-4/+2
| | | | | | | | | | 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-7/+37
| | | | | | | | | | | | | | | | | | 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
* Update tools to use new getStyle APIAntonio Maiorano2017-01-171-3/+6
| | | | | | | | Depends on https://reviews.llvm.org/D28081 Differential Revision: https://reviews.llvm.org/D28315 llvm-svn: 292175
* [change-namespace] get newlines around moved namespace right.Eric Liu2017-01-041-15/+12
| | | | | | | | | | | | 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
* [change-namespace] consider namespace aliases to shorten qualified names.Eric Liu2016-12-232-0/+44
| | | | | | | | | | 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-202-0/+17
| | | | | | | | | | | | 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
* [change-namespace] fix a case references to templated using alias are ↵Eric Liu2016-12-151-4/+6
| | | | | | qualified types. llvm-svn: 289816
* [change-namespace] handling templated type aliases correctly.Eric Liu2016-12-151-16/+32
| | | | | | | | | | | | 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
* [change-namespace] don't crash when type reference is in function type ↵Eric Liu2016-12-141-14/+28
| | | | | | | | | | | | parameter list. Reviewers: hokein Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D27758 llvm-svn: 289672
* modernize-use-auto NFC fixesPiotr Padlewski2016-12-141-1/+1
| | | | llvm-svn: 289656
* [change-namespace] always add a '::' prefix when a symbol reference needs to ↵Eric Liu2016-12-072-1/+8
| | | | | | be fully-qualified. llvm-svn: 288969
* [change-namespace] don't fix using shadow decls in classes.Eric Liu2016-12-071-10/+24
| | | | | | | | | | | | | | 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-072-7/+19
| | | | | | | | | | | | | | | | | | 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
* [change-namespace] get changing namespace to global correct.Eric Liu2016-12-051-2/+5
| | | | llvm-svn: 288662
* [change-namespace] don't generate replacements for files that don't match ↵Eric Liu2016-12-012-6/+13
| | | | | | | | | | | | file pattern. Reviewers: hokein Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D27302 llvm-svn: 288376
* [change-namespace] fix non-calling function references.Eric Liu2016-11-292-15/+36
| | | | | | | | | | Reviewers: hokein Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D27208 llvm-svn: 288139
* [change-namespace] handle constructor initializer: Derived : Base::Base() {} ↵Eric Liu2016-11-162-5/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [change-namespace] consider typedef/using alias decls in the moved namespace.Eric Liu2016-11-141-1/+20
| | | | | | | | | | | | 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
* Handle adding new nested namespace in old namespace.Eric Liu2016-11-101-11/+18
| | | | | | | | | | Reviewers: hokein Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26456 llvm-svn: 286486
* [change-namespace] dyn_cast -> cast.Eric Liu2016-11-101-3/+3
| | | | llvm-svn: 286485
* [change-namespace] shorten namespace qualifier based on UsingDecl and ↵Eric Liu2016-11-082-34/+119
| | | | | | | | | | | | | | | | | 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-tools-extra] Format sources with clang-format. NFC.Mandeep Singh Grang2016-11-081-4/+6
| | | | | | | | | | | | | | | | Summary: Ran clang-format on all .c/.cpp/.h files in clang-tools-extra. Excluded the test, unittests, clang-reorder-fields, include-fixer, modularize and pptrace directories. Reviewers: klimek, alexfh Subscribers: nemanjai Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D26329 llvm-svn: 286221
* [change-namespace] fix namespace specifiers of template arguments.Eric Liu2016-10-311-4/+6
| | | | llvm-svn: 285549
* Print stack trace for clang-change-namespace tool.Eric Liu2016-10-131-0/+2
| | | | llvm-svn: 284147
* [change-namespace] don't miss comments in the beginning of a namespace block.Eric Liu2016-10-121-13/+41
| | | | | | | | | | Reviewers: hokein Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25397 llvm-svn: 284011
* [change-namespace] Pass Style to ChangeNamespaceTool.Haojian Wu2016-10-051-1/+1
| | | | llvm-svn: 283338
* [change-namespace] Fixed a bug in getShortestQualifiedNameInNamespace.Eric Liu2016-10-051-10/+13
| | | | | | | | | | Reviewers: hokein Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25065 llvm-svn: 283333
OpenPOWER on IntegriCloud