[PATCH] D92800: [Clang] Make nomerge attribute a function attribute as well as a statement attribute.

Zequan Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 16 17:36:07 PST 2020


zequanwu added inline comments.


================
Comment at: clang/utils/TableGen/ClangAttrEmitter.cpp:3438-3439
       }
+      if (DeclOrStmt)
+        DiagList.push_back("statements");
     }
----------------
aaron.ballman wrote:
> I think this will do the wrong thing when the subject list has more than one entry (I think this will add `statements` to the list once for each subject). As an experiment, can you add `ObjCMethod` to the list of subjects for `NoMerge` in Attr.td? Do the resulting diagnostics list "statements" once or twice?
> 
> Thinking a bit deeper on this -- I think my original advice may have been too ambitious (we don't yet have support for automatically grabbing the names of statements for diagnostics like we do for declarations). Trying to add that as part of this patch would be a big ask, so I think a better approach is to use a custom diagnostic in Attr.td. I'll add a comment there to this effect.
You're right. If I just add `ObjCMethod` to the list of subjects for `NoMerge`, the "statements" shows twice in the diag.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92800



More information about the cfe-commits mailing list