[PATCH] D19314: [include-fixer] Add a prototype for a new include fixing tool.

Benjamin Kramer via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 20 03:07:24 PDT 2016


bkramer created this revision.
bkramer added a reviewer: djasper.
bkramer added subscribers: cfe-commits, hokein, ioeric.

The goal of this tool is fairly simple, look up unknown identifiers in a
global database and add the corresponding #include line. It accomplishes
this by hooking into Sema as an ExternalSemaSource and responding to typo
correction callbacks. This means we can see the unknown identifier before
it's being munged by error recovery.

This doesn't work perfectly yet as some typo corrections don't emit
callbacks (delayed typos), but I think this is fixable. We also handle
only one include at a time as this is meant to be run directly from
the editing environment eventually. Adding multiple includes at the same
time is tricky because of error recovery.

This version only has a a dummy database, so all you can do is fixing
missing includes of <string>, but the indexer to build a database will
follow soon.

http://reviews.llvm.org/D19314

Files:
  CMakeLists.txt
  include-fixer/CMakeLists.txt
  include-fixer/FixedXrefsDB.cpp
  include-fixer/FixedXrefsDB.h
  include-fixer/IncludeFixer.cpp
  include-fixer/IncludeFixer.h
  include-fixer/XrefsDB.h
  include-fixer/tool/CMakeLists.txt
  include-fixer/tool/ClangIncludeFixer.cpp
  unittests/CMakeLists.txt
  unittests/include-fixer/CMakeLists.txt
  unittests/include-fixer/IncludeFixerTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19314.54334.patch
Type: text/x-patch
Size: 26225 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160420/99b3e58c/attachment-0001.bin>


More information about the cfe-commits mailing list