[PATCH] D156172: [clang][CodeGen] Emit annotations for function declarations.

2023-09-13 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer added a comment. Reverted this in 88b7e06dcf9723d0869b0c6bee030b4140e4366d as it makes clang crash. Reduced test case in the commit description. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION http

[PATCH] D156172: [clang][CodeGen] Emit annotations for function declarations.

2023-09-06 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl updated this revision to Diff 556089. brendandahl added a comment. Rebase and fix unused variable warning. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156172/new/ https://reviews.llvm.org/D156172 Files: clang/lib/CodeGen/CodeGenMod

[PATCH] D156172: [clang][CodeGen] Emit annotations for function declarations.

2023-08-31 Thread Eli Friedman via Phabricator via cfe-commits
efriedma accepted this revision. efriedma added a comment. This revision is now accepted and ready to land. LGTM Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156172/new/ https://reviews.llvm.org/D156172 ___

[PATCH] D156172: [clang][CodeGen] Emit annotations for function declarations.

2023-08-24 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl added a comment. @efriedma ping Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156172/new/ https://reviews.llvm.org/D156172 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://list

[PATCH] D156172: [clang][CodeGen] Emit annotations for function declarations.

2023-08-08 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl added a comment. @efriedma I've updated the patch to fix the decl-use-decl example and added a test for it. Anything else? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156172/new/ https://reviews.llvm.org/D156172

[PATCH] D156172: [clang][CodeGen] Emit annotations for function declarations.

2023-08-03 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl updated this revision to Diff 546986. brendandahl added a comment. Cleanup some extra brackets. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156172/new/ https://reviews.llvm.org/D156172 Files: clang/lib/CodeGen/CodeGenModule.cpp c

[PATCH] D156172: [clang][CodeGen] Emit annotations for function declarations.

2023-08-03 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl updated this revision to Diff 546966. brendandahl added a comment. Update deferred annotations whenever EmitGlobalDefinition is called with a FunctionDecl and it has already been used or defined. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.

[PATCH] D156172: [clang][CodeGen] Emit annotations for function declarations.

2023-08-03 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment. I'm happy with this approach. Comment at: clang/lib/CodeGen/CodeGenModule.cpp:4327 +if (D && D->hasAttr() && isa(Entry)) + DeferredAnnotations[cast(Entry)] = cast(D); + This doesn't quite seem sufficient... I'd expect you'd wa

[PATCH] D156172: [clang][CodeGen] Emit annotations for function declarations.

2023-08-02 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl updated this revision to Diff 546632. brendandahl added a comment. Switch to emitting annotations and the end. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156172/new/ https://reviews.llvm.org/D156172 Files: clang/lib/CodeGen/CodeGe

[PATCH] D156172: [clang][CodeGen] Emit annotations for function declarations.

2023-07-28 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D156172#4540025 , @brendandahl wrote: > I looked into the above issue with mixing declarations and definitions and I > think I can fix that by leaving the AddGlobalAnnotations call in > EmitGlobalFunctionDefinition and

[PATCH] D156172: [clang][CodeGen] Emit annotations for function declarations.

2023-07-27 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl added a comment. I looked into the above issue with mixing declarations and definitions and I think I can fix that by leaving the AddGlobalAnnotations call in EmitGlobalFunctionDefinition and only calling AddGlobalAnnotations from GetOrCreateLLVMFunction when it's for a definition.

[PATCH] D156172: [clang][CodeGen] Emit annotations for function declarations.

2023-07-25 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment. Slightly messed up my example because I forgot the function was unprototyped. The following should show what I mean: void foo(void); void *xxx = (void*)foo; __attribute__((annotate("bar"))) void foo(){} In terms of where the right place is, I don't recall the ex

[PATCH] D156172: [clang][CodeGen] Emit annotations for function declarations.

2023-07-25 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl added a comment. That example appears to still work the same with my patch: @xxx = global ptr @foo, align 8 @.str = private unnamed_addr constant [4 x i8] c"bar\00", section "llvm.metadata" @.str.1 = private unnamed_addr constant [8 x i8] c"main2.c\00", section "llvm.metadata"

[PATCH] D156172: [clang][CodeGen] Emit annotations for function declarations.

2023-07-25 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment. The idea of emitting annotations on declarations seems fine. (LLVM itself doesn't consume annotations anyway; they're meant as an extension mechanism for third-party tools.) I'm a bit concerned the way this is implemented will end up dropping annotations we would pre

[PATCH] D156172: [clang][CodeGen] Emit annotations for function declarations.

2023-07-25 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl added a comment. A little more context for the new reviewers. Over in this patch I added support for annotations to be emitted into WebAssembly. We'd like to use this to mark imported (declarations) and exported (definitions) of functions with spec

[PATCH] D156172: [clang][CodeGen] Emit annotations for function declarations.

2023-07-25 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added reviewers: efriedma, rjmccall, erichkeane. aaron.ballman added a comment. Adding additional reviewers for more opinions. The changes seem reasonable to me given that the annotation attribute is used to squirrel data from the frontend to the backend (including via plugin attr

[PATCH] D156172: [clang][CodeGen] Emit annotations for function declarations.

2023-07-24 Thread Brendan Dahl via Phabricator via cfe-commits
brendandahl created this revision. Herald added a project: All. brendandahl requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Previously, annotations were only emitted for function definitions. With this change annotations are also emitted fo