[PATCH] D84005: Introduce ns_error_domain attribute.
Bruno Ricci via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 24 05:33:57 PDT 2020
riccibruno added inline comments.
================
Comment at: clang/lib/Sema/SemaDeclAttr.cpp:5344
+ if (!S.LookupName(lookupResult, S.TUScope) ||
+ !lookupResult.getAsSingle<VarDecl>()) {
+ S.Diag(IdentLoc->Loc, diag::err_nserrordomain_invalid_decl)
----------------
Just a note that `LookupResult::getAsSingle` has tricky semantics (returns null if the result is not exactly `LookupResultKind::Found`) and has been (and still is) the source of many bugs in clang.
(Example: my favourite one is still the silly:
```
struct S {
void not_overloaded();
enum { not_overloaded }; // error; redefinition of 'not_overloaded'
void overloaded();
void overloaded(int);
enum { overloaded }; // clang is fine with this!
};
```
)
I don't know if it is a problem here or not though.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D84005/new/
https://reviews.llvm.org/D84005
More information about the cfe-commits
mailing list