[PATCH] D19869: Added XrefsDBManager into include-fixer and made XrefsDB return SymbolInfo.

Eric Liu via cfe-commits cfe-commits at lists.llvm.org
Tue May 3 11:02:07 PDT 2016


ioeric added inline comments.

================
Comment at: include-fixer/InMemoryXrefsDB.cpp:24-26
@@ +23,5 @@
+    for (const auto &Header : Entry.second) {
+      SymbolInfo Info;
+      Info.Name = Names.back();
+      Info.FilePath = Header;
+      for (auto IdentiferContext = Names.rbegin() + 1;
----------------
klimek wrote:
> I assume it's intentional that SymbolInfo doesn't have a constructor; what's the reasoning behind that?
SymbolInfo can be of different kinds, e.g. Function, Class etc. and has optional fields. I think this was the reason we didn't have a constructor for it. @hokein, right?

================
Comment at: include-fixer/IncludeFixer.h:34
@@ -33,2 +33,3 @@
   IncludeFixerActionFactory(
-      XrefsDB &Xrefs, std::vector<clang::tooling::Replacement> &Replacements,
+      XrefsDBManager &XrefsDBMgr,
+      std::vector<clang::tooling::Replacement> &Replacements,
----------------
klimek wrote:
> Why wouldn't we still use the interface here? (usually we want to take the least specific type we can deal with)
XrefsDBManager now provides a different interface. XrefsDB provides `std::vector<SymbolInfo> search(...)`, while XrefsDBManager provides `std::vector<std::string> search(...)`, which just returns the #include paths.


http://reviews.llvm.org/D19869





More information about the cfe-commits mailing list