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

Saleem Abdulrasool via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 29 09:01:20 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:

`isa<CXXConstructorDecl>` and `isa<CXXDestructorDecl>` would identify those. The important thing is that it expresses concretely what you are trying to avoid.

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


More information about the cfe-commits mailing list