[all-commits] [llvm/llvm-project] fa4a0f: [modules] Add a flag for TagDecl if it was a defin...

Volodymyr Sapsai via All-commits all-commits at lists.llvm.org
Mon Feb 14 16:05:13 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fa4a0f1d31e2f797c3e27eb7cad15755e46a4726
      https://github.com/llvm/llvm-project/commit/fa4a0f1d31e2f797c3e27eb7cad15755e46a4726
  Author: Volodymyr Sapsai <vsapsai at apple.com>
  Date:   2022-02-14 (Mon, 14 Feb 2022)

  Changed paths:
    M clang/include/clang/AST/Decl.h
    M clang/include/clang/AST/DeclBase.h
    M clang/lib/AST/Decl.cpp
    M clang/lib/Serialization/ASTReaderDecl.cpp

  Log Message:
  -----------
  [modules] Add a flag for TagDecl if it was a definition demoted to a declaration.

For redeclaration chains we maintain an invariant of having only a
single definition in the chain. In a single translation unit we make
sure not to create duplicates. But modules are separate translation
units and they can contain definitions for the same symbol
independently. When we load such modules together, we need to demote
duplicate definitions to keep the AST invariants.

Some AST clients are interested in distinguishing
declaration-that-was-demoted-from-definition and
declaration-that-was-never-a-definition. For that purpose introducing
`IsThisDeclarationADemotedDefinition`. No functional change intended.

rdar://84677782

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




More information about the All-commits mailing list