[PATCH] D13931: [Tooling] Add a utility function to replace one nested name with another.

Benjamin Kramer via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 21 02:46:43 PDT 2015


bkramer created this revision.
bkramer added a reviewer: klimek.
bkramer added a subscriber: cfe-commits.
Herald added a subscriber: klimek.

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.

http://reviews.llvm.org/D13931

Files:
  include/clang/Tooling/Core/Lookup.h
  lib/Tooling/Core/CMakeLists.txt
  lib/Tooling/Core/Lookup.cpp
  unittests/Tooling/CMakeLists.txt
  unittests/Tooling/LookupTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13931.37976.patch
Type: text/x-patch
Size: 10402 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151021/a5458d7a/attachment.bin>


More information about the cfe-commits mailing list