[PATCH] D121927: [Clang] Work with multiple pragmas weak before definition

Hubert Tong via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 17 10:22:17 PDT 2022


hubert.reinterpretcast created this revision.
hubert.reinterpretcast added reviewers: jamieschmeiser, aaron.ballman, chandlerc, cebowleratibm, w2yehia.
Herald added a project: All.
hubert.reinterpretcast requested review of this revision.
Herald added a project: clang.

Update `WeakUndeclaredIdentifiers` to hold a collection of weak aliases per identifier instead of only one.

This also allows the "used" state to be removed from `WeakInfo` because it is really only there as an alternative to removing processed map entries, and we can represent that using an empty set now. The serialization code is updated for the removal of the field. Additionally, a PCH test is added for the new functionality.

The records are grouped by the "target" identifier, which was already being used as a key for lookup purposes. We also store only one record per alias name; combined, this means that diagnostics are grouped by the "target" and limited to one per alias (which should be acceptable).

Fixes PR28611.
Fixes llvm/llvm-project#28985.

Co-authored-by: Rachel Craik <rcraik at ca.ibm.com>
Co-authored-by: Jamie Schmeiser <schmeise at ca.ibm.com>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121927

Files:
  clang/include/clang/Sema/Sema.h
  clang/include/clang/Sema/Weak.h
  clang/lib/Sema/Sema.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTWriter.cpp
  clang/test/CodeGen/pragma-weak.c
  clang/test/PCH/pragma-weak-functional.c
  clang/test/PCH/pragma-weak-functional.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121927.416235.patch
Type: text/x-patch
Size: 14434 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220317/63a29bfd/attachment-0001.bin>


More information about the cfe-commits mailing list