[clang] [serialization] Step into UsingShadowDecl when find existing decl (#208393) Close https://github.com/llvm/llvm-project/issues/207581 The root cause of the problem is that:enum constant decl, for which its parent is not enum class, is special. They can be accessed directly without access its parent. When modules join the game, it becomes more complex. As for members in other entities like class, we can assume the member is accessable if their parent are accesable. But it is a different story for enums. See https://github.com/llvm/llvm-project/issues/131058 for the whole story of the backrgound. Then we didn't write enum constant decl to the lookup table of its parent of parent in the ASTWriter. So that if other consumer in Sema wants to access them, they have to get it by entities like exported using decls. However, the problem is, in ASTReader, when we merge decls, we use noload_lookup to find existing decls. And the absense of unnamed enum decl in the parent of its parent's lookup table makes the merge fails. For enum constant decl in named enum, they will still have a name lookup table. So we will merge them somehow. But for enum constants in unnamed enum, they were removed from the only lookup table so the merge fails. This is the whole story of the current issue. To fix this, when we merge decls, we step into the UsingShadowDecl to find the real decls. This is fine as we never merge decls with different kinds. We can even call this a tiny optimization.
Welcome to the LLVM project!
This repository contains the source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and run-time environments.
The LLVM project has multiple components. The core of the project is itself called “LLVM”. This contains all of the tools, libraries, and header files needed to process intermediate representations and convert them into object files. Tools include an assembler, disassembler, bitcode analyzer, and bitcode optimizer.
C-like languages use the Clang frontend. This component compiles C, C++, Objective-C, and Objective-C++ code into LLVM bitcode -- and from there into object files, using LLVM.
Other components include: the libc++ C++ standard library, the LLD linker, and more.
Consult the Getting Started with LLVM page for information on building and running LLVM.
For information on how to contribute to the LLVM project, please take a look at the Contributing to LLVM guide.
Join the LLVM Discourse forums, Discord chat, LLVM Office Hours or Regular sync-ups.
The LLVM project has adopted a code of conduct for participants to all modes of communication within the project.