[all-commits] [llvm/llvm-project] 68f539: [ASTImporter] Fix import of a typedef that has an ...

Gabor Marton via All-commits all-commits at lists.llvm.org
Mon Dec 14 09:32:09 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 68f53960e17d93c3a2727164dac4e54140bd98ba
      https://github.com/llvm/llvm-project/commit/68f53960e17d93c3a2727164dac4e54140bd98ba
  Author: Gabor Marton <gabor.marton at ericsson.com>
  Date:   2020-12-14 (Mon, 14 Dec 2020)

  Changed paths:
    M clang/lib/AST/ASTImporter.cpp
    M clang/unittests/AST/ASTImporterTest.cpp

  Log Message:
  -----------
  [ASTImporter] Fix import of a typedef that has an attribute

The import of a typedefs with an attribute uses clang::Decl::setAttrs().
But that needs the ASTContext which we can get only from the
TranslationUnitDecl. But we can get the TUDecl only thourgh the
DeclContext, which is not set by the time of the setAttrs call.

Fix: import the attributes only after the DC is surely imported.
Btw, having the attribute import initiated from GetImportedOrCreateDecl was
fundamentally flawed. Now that is implicitly fixed.

Differential Revision: https://reviews.llvm.org/D92962




More information about the All-commits mailing list