rnk added inline comments.
================ Comment at: clang/include/clang/Basic/Attr.td:1799 + let Spellings = [Clang<"nomerge">]; + let Subjects = SubjectList<[Function]>; + let Documentation = [NoMergeDocs]; ---------------- Clang supports many function-like things that are not functions, for example, Objective C method declarations are not considered FunctionDecls in the AST. Blocks are another function-like thing. I see below there is a `FunctionLike` subject type. Lets use that here. I would like to make it possible to apply this attribute directly to call expressions as well, but I don't see a good example of how to do that in the existing attribute. I'd like to be able to do this, for example: ``` void __attribute__((noreturn)) bar(); void foo(bool cond) { if (cond) [[clang::nomerge]] bar(); else [[clang::nomerge]] bar(); } ``` This gives the user fine-grained control. It allows them to call some existing API, like perhaps RaiseException, of which they do not control the declaration, and mark the calls as unmergeable. ================ Comment at: clang/test/CodeGen/attr-nomerge.c:15 +// CHECK: attributes #1 = { nomerge {{.*}} } +// CHECK: attributes #2 = { nomerge } ---------------- These numbers can be unstable. Generally the best practice is to do something like this: // CHECK: declare void @bar() #[[NOMERGEATTR:\d+]] // CHECK: attributes #[[NOMERGEATTR]] = { nomerge {{.*}} } This makes the test more readable and more resilient in the case that the attribute set numbers change. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D79121/new/ https://reviews.llvm.org/D79121 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits