[PATCH] D147037: [Clang][ICE] Corrected invalid invalid parameter index on some attributes with invalid indices applied to varargs functions

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 28 12:49:37 PDT 2023


aaron.ballman added a reviewer: erichkeane.
aaron.ballman added a comment.

Thanks for working on this fix! A few things:

- Please add a summary description to the patch, and be sure to include a reference to the github issue in the summary.
- All functional changes (e.g., not typo fixes, fixes to comments, or other NFC changes) need test coverage that demonstrates the issue has been resolved.
- All functional changes should have a release note in `clang/docs/ReleaseNotes.rst`



================
Comment at: clang/lib/Sema/SemaDeclAttr.cpp:3764-3767
   if (!checkFunctionOrMethodParameterIndex(S, D, AL, 1, IdxExpr, Idx))
     return;
-
+  if (Idx.getASTIndex() >= getFunctionOrMethodNumParams(D))
+    return;
----------------
Did you look into fixing this within `checkFunctionOrMethodParameterIndex()` instead? That way, all callers of the API get the correct behavior instead of having to find individual attributes to check the logic (I believe there are other attributes with the same underlying problem).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147037/new/

https://reviews.llvm.org/D147037



More information about the cfe-commits mailing list