[PATCH] D42071: [Sema] Add a callback in VisibleDeclConsumer allowing client to know which DeclContext is going to visit.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 15 08:05:42 PST 2018


hokein created this revision.
hokein added a reviewer: ilya-biryukov.

Repository:
  rC Clang

https://reviews.llvm.org/D42071

Files:
  include/clang/Sema/Lookup.h
  lib/Sema/SemaLookup.cpp


Index: lib/Sema/SemaLookup.cpp
===================================================================
--- lib/Sema/SemaLookup.cpp
+++ lib/Sema/SemaLookup.cpp
@@ -3507,6 +3507,8 @@
   if (Visited.visitedContext(Ctx->getPrimaryContext()))
     return;
 
+  Consumer.BeginVisitContext(Ctx);
+
   // Outside C++, lookup results for the TU live on identifiers.
   if (isa<TranslationUnitDecl>(Ctx) &&
       !Result.getSema().getLangOpts().CPlusPlus) {
Index: include/clang/Sema/Lookup.h
===================================================================
--- include/clang/Sema/Lookup.h
+++ include/clang/Sema/Lookup.h
@@ -784,6 +784,11 @@
   /// class of the context we searched.
   virtual void FoundDecl(NamedDecl *ND, NamedDecl *Hiding, DeclContext *Ctx,
                          bool InBaseClass) = 0;
+
+  /// \brief Callback to inform the client that Sema begins to visit a context.
+  //
+  /// \param Ctx the context which Sema begins to visit.
+  virtual void BeginVisitContext(DeclContext *Ctx) {};
 };
 
 /// \brief A class for storing results from argument-dependent lookup.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42071.129859.patch
Type: text/x-patch
Size: 1082 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180115/bbe7bb4c/attachment.bin>


More information about the cfe-commits mailing list