summaryrefslogtreecommitdiffstats
path: root/clang/lib/Tooling/Core/Lookup.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Lookup] Invisible decls should not be ambiguous when renaming.Eric Liu2019-04-151-5/+16
| | | | | | | | | | | | | | | | | | Summary: For example, a renamed type in a header file can conflict with declaration in a random file that includes the header, but we should not consider the decl ambiguous if it's not visible at the rename location. This improves consistency of generated replacements when header file is included in different TUs. Reviewers: hokein Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60257 llvm-svn: 358378
* [Tooling] Add more scope specifiers until spelling is not ambiguous.Eric Liu2019-03-191-27/+47
| | | | | | | | | | | | | | | | | | Summary: Previously, when the renamed spelling is ambiguous, we simply use the full-qualfied name (with leading "::"). This patch makes it try adding additional specifiers one at a time until name is no longer ambiguous, which allows us to find better disambuguated spelling. Reviewers: kadircet, gribozavr Subscribers: jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59487 llvm-svn: 356446
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | 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
* Fully qualify the renamed symbol if the shortened name is ambiguous.Eric Liu2018-08-031-2/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: For example, when renaming `a::b::x::foo` to `y::foo` below, replacing `x::foo()` with `y::foo()` can cause ambiguity. In such cases, we simply fully qualify the name with leading `::`. ``` namespace a { namespace b { namespace x { void foo() {} } namespace y { void foo() {} } } } namespace a { namespace b { void f() { x::foo(); } } } ``` Reviewers: ilya-biryukov, hokein Reviewed By: ilya-biryukov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D50189 llvm-svn: 338832
* Do not do raw name replacement when FromDecl is a class forward-declaration.Eric Liu2016-11-251-3/+10
| | | | | | | | | | | | | | | Summary: If the `FromDecl` is a class forward declaration, the reference is still considered as referring to the original definition given the nature of forward-declarations, so we can't do a raw name replacement in this case. Reviewers: bkramer Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D27132 llvm-svn: 287929
* Consider nested namespaces in the canonical namespace as canonical as well.Eric Liu2016-11-251-31/+49
| | | | | | | | | | | | | | | | | | | | Summary: For example, this case was missed when looking for different but canonical namespaces. UseContext in this case should be considered as in the canonical namespace. ``` namespace a { namespace b { <FromContext> } } namespace a { namespace b { namespace c { <UseContext> } } } ``` Added some commenting. Reviewers: bkramer Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D27125 llvm-svn: 287924
* [Tooling] skip anonymous namespaces when checking if typeLoc references a ↵Eric Liu2016-07-261-16/+29
| | | | | | | | | | | | | | | | type decl from a different canonical namespace. Summary: [Tooling] skip anonymous namespaces when checking if typeLoc references a type decl from a different canonical namespace. Reviewers: bkramer Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D22808 llvm-svn: 276754
* [Tooling] Add a utility function to replace one nested name with another.Benjamin Kramer2015-10-221-0/+113
One problem in clang-tidy and other clang tools face is that there is no way to lookup an arbitrary name in the AST, that's buried deep inside Sema and might not even be what the user wants as the new name may be freshly inserted and not available in the AST. A common use case for lookups is replacing one nested name with another while minimizing namespace qualifications, so replacing 'ns::foo' with 'ns::bar' will use just 'bar' if we happen to be inside the namespace 'ns'. This adds a little helper utility for exactly that use case. Differential Revision: http://reviews.llvm.org/D13931 llvm-svn: 251022
OpenPOWER on IntegriCloud