[clang] [ObjC] Make isObjCSelType see through typedefs of SEL (PR #247767)
Oliver Hunt via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 1 19:10:02 PST 2026
ojhunt wrote:
> Okay, maybe the typedef redefinition thing never applied to SEL, which is great news.
>
> It's weird that we'd be checking completely different predicates, though. Do they overlap somehow, like the predefined `SEL` typedef is actually a pointer to the builtin type? In that case, maybe we need to audit all the uses of the first predicate, because most of them should probably be using that second predicate that checks for the builtin. If there's anything that specifically cares about the spelling (not that unlikely), we can rename it to `isObjCSELTypedef()` or something like that.
I wouldn't be surprised if the different predicates are different people needing the same query at different times being unaware of the other, but it could also be a matter of the queries being needed without an ast context available.
For a lot of the c++ stdlib types the check is literally performed as name check on the canonical type - for example:
```cpp
bool Type::isStdByteType() const {
if (const auto *ET = getAsCanonical<EnumType>()) {
const auto *ED = ET->getDecl();
IdentifierInfo *II = ED->getIdentifier();
if (II && II->isStr("byte") && ED->isInStdNamespace())
return true;
}
return false;
}
```
there's a whole slew of these with the same general form. I'm really not sure what the best approach is (the string comparison is agonizing every time I see to, but absent a reference to a Sema object there's no other way
https://github.com/llvm/llvm-project/pull/247767
More information about the cfe-commits
mailing list