[PATCH] D53708: [ASTImporter] Add importer specific lookup

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 25 08:59:07 PDT 2018


martong created this revision.
martong added a reviewer: a_sidorin.
Herald added subscribers: cfe-commits, Szelethus, dkrupp, rnkovacs, mgorny.
Herald added a reviewer: a.sidorin.

There are certain cases when normal C/C++ lookup (localUncachedLookup)
does not find AST nodes. E.g.:

Example 1:

  template <class T>
  struct X {
    friend void foo(); // this is never found in the DC of the TU.
  };

Example 2:

  // The fwd decl to Foo is not found in the lookupPtr of the DC of the
  // translation unit decl.
  struct A { struct Foo *p; };

In these cases we create a new node instead of returning with the old one.
To fix it we create a new lookup table which holds every node and we are
not interested in any C++ specific visibility considerations.
Simply, we must know if there is an existing Decl in a given DC.


Repository:
  rC Clang

https://reviews.llvm.org/D53708

Files:
  include/clang/AST/ASTImporter.h
  include/clang/AST/ASTImporterLookupTable.h
  include/clang/CrossTU/CrossTranslationUnit.h
  lib/AST/ASTImporter.cpp
  lib/AST/ASTImporterLookupTable.cpp
  lib/AST/CMakeLists.txt
  lib/CrossTU/CrossTranslationUnit.cpp
  lib/Frontend/ASTMerge.cpp
  tools/clang-import-test/clang-import-test.cpp
  unittests/AST/ASTImporterTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53708.171114.patch
Type: text/x-patch
Size: 54806 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181025/b80194fa/attachment-0001.bin>


More information about the cfe-commits mailing list