[clang] [clang][tools] Handle weak (and duplicate) symbols in clang-extdef-mapping (PR #222010)
DonĂ¡t Nagy via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 9 02:35:35 PDT 2026
================
@@ -100,8 +101,17 @@ void MapExtDefNamesConsumer::addIfInMain(const DeclaratorDecl *DD,
case Linkage::External:
case Linkage::VisibleNone:
case Linkage::UniqueExternal:
- if (SM.isInMainFile(defStart))
- Index[*LookupName] = CurrentFileName;
+ if (SM.isInMainFile(defStart)) {
+ if (!DD->hasAttr<WeakAttr>()) {
+ Index[*LookupName] = CurrentFileName;
+ WeakNames.erase(*LookupName);
+ } else {
+ if (!Index.contains(*LookupName)) {
+ Index[*LookupName] = CurrentFileName;
+ WeakNames.insert(*LookupName);
+ }
+ }
----------------
NagyDonat wrote:
```suggestion
} else if (!Index.contains(*LookupName)) {
Index[*LookupName] = CurrentFileName;
WeakNames.insert(*LookupName);
}
```
https://github.com/llvm/llvm-project/pull/222010
More information about the cfe-commits
mailing list