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

Egor Zhdan via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 29 09:31:56 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()) {
----------------
egorzhdan wrote:

Alright, I replaced this with an explicit check for operators, constructors and destructors.

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


More information about the cfe-commits mailing list