[clang] [ObjC] Insert method parameters in scope as they are parsed (PR #113745)
Akira Hatanaka via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 30 12:52:40 PDT 2024
================
@@ -4768,60 +4822,9 @@ Decl *SemaObjC::ActOnMethodDeclaration(
HasRelatedResultType);
SmallVector<ParmVarDecl*, 16> Params;
-
- for (unsigned i = 0, e = Sel.getNumArgs(); i != e; ++i) {
- QualType ArgType;
- TypeSourceInfo *DI;
-
- if (!ArgInfo[i].Type) {
- ArgType = Context.getObjCIdType();
- DI = nullptr;
- } else {
- ArgType = SemaRef.GetTypeFromParser(ArgInfo[i].Type, &DI);
- }
-
- LookupResult R(SemaRef, ArgInfo[i].Name, ArgInfo[i].NameLoc,
- Sema::LookupOrdinaryName,
- SemaRef.forRedeclarationInCurContext());
- SemaRef.LookupName(R, S);
- if (R.isSingleResult()) {
- NamedDecl *PrevDecl = R.getFoundDecl();
- if (S->isDeclScope(PrevDecl)) {
- Diag(ArgInfo[i].NameLoc,
- (MethodDefinition ? diag::warn_method_param_redefinition
- : diag::warn_method_param_declaration))
- << ArgInfo[i].Name;
- Diag(PrevDecl->getLocation(),
- diag::note_previous_declaration);
- }
- }
-
- SourceLocation StartLoc = DI
- ? DI->getTypeLoc().getBeginLoc()
- : ArgInfo[i].NameLoc;
-
- ParmVarDecl *Param =
- SemaRef.CheckParameter(ObjCMethod, StartLoc, ArgInfo[i].NameLoc,
- ArgInfo[i].Name, ArgType, DI, SC_None);
-
- Param->setObjCMethodScopeInfo(i);
-
- Param->setObjCDeclQualifier(
- CvtQTToAstBitMask(ArgInfo[i].DeclSpec.getObjCDeclQualifier()));
-
- // Apply the attributes to the parameter.
- SemaRef.ProcessDeclAttributeList(SemaRef.TUScope, Param,
- ArgInfo[i].ArgAttrs);
- SemaRef.AddPragmaAttributes(SemaRef.TUScope, Param);
- SemaRef.ProcessAPINotes(Param);
----------------
ahatanak wrote:
It looks like the call to `ProcessAPINotes` is dropped. Was that intentional?
https://github.com/llvm/llvm-project/pull/113745
More information about the cfe-commits
mailing list