[PATCH] D51688: [clangd] Set SymbolID for sema macros so that they can be merged with index macros.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 5 09:43:50 PDT 2018


sammccall accepted this revision.
sammccall added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clangd/AST.h:41
+/// Gets the symbol ID for a macro, if possible.
+llvm::Optional<SymbolID> getSymbolID(const IdentifierInfo &II,
+                                     const MacroInfo *MI,
----------------
maybe add a comment about the semantics of macro symbol IDs - particularly that they depend on the exact file offset.

We could change these semantics in future by reimplementing this function, there's no reason we have to use USRs for everything, and macros are really simple.


================
Comment at: clangd/index/SymbolCollector.cpp:389
   llvm::SmallString<128> USR;
   if (index::generateUSRForMacro(Name->getName(), MI->getDefinitionLoc(), SM,
                                  USR))
----------------
this is now dead


================
Comment at: clangd/index/SymbolCollector.cpp:452
       if (const auto *MI = PP->getMacroDefinition(II).getMacroInfo())
         if (!index::generateUSRForMacro(II->getName(), MI->getDefinitionLoc(),
                                         PP->getSourceManager(), USR))
----------------
update this to use getSymbolID


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51688





More information about the cfe-commits mailing list