[PATCH] D49028: [clangd] Support indexing MACROs.

Eric Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 9 03:11:35 PDT 2018


ioeric added inline comments.


================
Comment at: clangd/index/SymbolCollector.cpp:360
+
+  llvm::SmallString<128> USR;
+  if (index::generateUSRForMacro(Name.getName(), MI.getDefinitionLoc(), SM,
----------------
sammccall wrote:
> as above, can we avoid generating the USR for every reference?
> The macro name or hash thereof should be enough to identify it, right?
I thought I needed to store both the name and the location in order to calculate USR for macros, and just calculating USRs seems easier and not too expensive. But after another look, it turned out that `IdentifierInfo` + `Preprocessor` would also work. Thanks for pressing on this! :) 


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D49028





More information about the cfe-commits mailing list