[clang] [APINotes] Do not crash for C++ operators (PR #101001)

Saleem Abdulrasool via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 29 08:43:21 PDT 2024


================
@@ -1044,11 +1044,13 @@ void Sema::ProcessAPINotes(Decl *D) {
 
   if (auto TagContext = dyn_cast<TagDecl>(D->getDeclContext())) {
     if (auto CXXMethod = dyn_cast<CXXMethodDecl>(D)) {
-      for (auto Reader : APINotes.findAPINotes(D->getLocation())) {
-        if (auto Context = UnwindTagContext(TagContext, APINotes)) {
-          auto Info =
-              Reader->lookupCXXMethod(Context->id, CXXMethod->getName());
-          ProcessVersionedAPINotes(*this, CXXMethod, Info);
+      if (CXXMethod->getIdentifier()) {
----------------
compnerd wrote:

I think that this is better spelt as `isa<NamedDecl>(CXXMethod)`. The `IdentifierInfo` is not preserved/used.

https://github.com/llvm/llvm-project/pull/101001


More information about the cfe-commits mailing list