[PATCH] D48961: [Index] Add indexing support for MACROs.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 9 00:07:06 PDT 2018


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


================
Comment at: include/clang/Index/IndexDataConsumer.h:48
   /// \returns true to continue indexing, or false to abort.
-  virtual bool handleMacroOccurence(const IdentifierInfo *Name,
-                                    const MacroInfo *MI, SymbolRoleSet Roles,
+  virtual bool handleMacroOccurence(const IdentifierInfo &Name,
+                                    const MacroInfo &MI, SymbolRoleSet Roles,
----------------
the change from pointer->reference seems maybe unneccesary, and inconsistent with other callbacks? up to you though, doesn't seem like a big deal either way.


================
Comment at: include/clang/Index/IndexSymbol.h:105
+  Implicit = 1 << 8,
+  // FIXME: this is not mirrored in CXSymbolRole.
+  Undefinition = 1 << 9, // macro #undef
----------------
maybe mention that macro occurrences aren't currently reported by libclang? as it's related.


================
Comment at: lib/Index/IndexingContext.cpp:422
+                                           const MacroInfo &MI) {
+  SymbolRoleSet Roles = (unsigned)SymbolRole::Reference;
+  DataConsumer.handleMacroOccurence(Name, MI, Roles, Loc, /*Undefined=*/true);
----------------
this should be Undefinition (and drop the Undefined flag).


Repository:
  rC Clang

https://reviews.llvm.org/D48961





More information about the cfe-commits mailing list