================
@@ -1397,28 +1440,73 @@ void Sema::ProcessAPINotes(Decl *D) {
auto Info = Reader->lookupCXXMethod(Context->id, MethodName);
ProcessVersionedAPINotes(*this, CXXMethod, Info);
- if (ParameterSelectorCandidates)
+ auto &DiagnosticState =
+ getAPINotesSelectorDiagnosticState(*this, Reader);
+ if (auto NameOnlyKey =
+ Reader->getCXXMethodSelectorKey(Context->id, MethodName))
+ DiagnosticState.noteSeenDeclaration(*NameOnlyKey, MethodName,
+ CXXMethod->getLocation());
+
+ if (ParameterSelectorCandidates) {
processExactAPINotes<api_notes::CXXMethodInfo>(
*this, CXXMethod, *ParameterSelectorCandidates,
[&](ArrayRef<std::string> Parameters) {
return Reader->lookupCXXMethod(Context->id, MethodName,
Parameters);
});
-
- if (ParameterSelectorCandidates) {
- auto &DiagnosticState =
- getAPINotesSelectorDiagnosticState(*this, Reader);
- if (auto BroadKey =
- Reader->getCXXMethodSelectorKey(Context->id, MethodName))
- DiagnosticState.noteSeenDeclaration(*BroadKey, MethodName,
- CXXMethod->getLocation());
DiagnosticState.markCandidatesUsed(
[&](ArrayRef<std::string> Parameters) {
return Reader->getCXXMethodSelectorKey(
Context->id, MethodName, Parameters);
},
*ParameterSelectorCandidates);
}
+
+ if (CXXMethod->isImplicitObjectMemberFunction()) {
+ SmallVector<api_notes::FunctionObjectSelector, 7>
ObjectSelectors;
+ getAPINotesObjectSelectorSubsets(
+ getAPINotesObjectSelector(CXXMethod), ObjectSelectors);
+ // Apply every matching object selector in increasing
specificity.
----------------
Xazax-hun wrote:
I see your point, but I think we might not want to have this sort of complexity
in APINotes. I am wondering if it would be easier to just diagnose if there are
2 APINotes applied to the same declaration but they wanted to apply conflicting
attributes. That being said, if this is too much work, I think it is OK to just
have any order for now and we will figure out the semantics and the diagnostics
story for this overlap later on. What do you think?
https://github.com/llvm/llvm-project/pull/216148
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits