[PATCH] D126559: [MSVC] Fix pragma alloc_text failing for C files

2022-06-21 Thread Stephen Long via Phabricator via cfe-commits
steplong added a comment. I tried the following: FunctionDecl *FD = ND->getAsFunction(); DeclContext *DC = ND->getDeclContext(); DEBUG_WITH_TYPE("foo", llvm::dbgs() << "[FOO] DC->isExternCContext() : " << DC->isExternCContext() << "\n"); DEBUG_WITH_TYPE("foo",

[PATCH] D126559: [MSVC] Fix pragma alloc_text failing for C files

2022-06-21 Thread Stephen Long via Phabricator via cfe-commits
steplong added a comment. In D126559#3598950 , @hans wrote: >> Oh I see, that makes sense. We aren't accepting >> https://godbolt.org/z/9Yej9vhYd. Do you know of a way to get the `NamedDecl` >> with `extern "C"` instead of the second declaration? > >

[PATCH] D126559: [MSVC] Fix pragma alloc_text failing for C files

2022-06-21 Thread Hans Wennborg via Phabricator via cfe-commits
hans added a comment. > Oh I see, that makes sense. We aren't accepting > https://godbolt.org/z/9Yej9vhYd. Do you know of a way to get the `NamedDecl` > with `extern "C"` instead of the second declaration? I'm not sure I understand the question, but it seems the current code is checking

[PATCH] D126559: [MSVC] Fix pragma alloc_text failing for C files

2022-06-21 Thread Stephen Long via Phabricator via cfe-commits
steplong added a comment. In D126559#3598885 , @hans wrote: >> Ignoring the `pragma alloc_text`, it looks like GCC compiles the following >> `foo` with C linkage vs LLVM which compiles with C++ linkage (foo's name is >> mangled): > > The mangled name

[PATCH] D126559: [MSVC] Fix pragma alloc_text failing for C files

2022-06-21 Thread Hans Wennborg via Phabricator via cfe-commits
hans added a comment. > Ignoring the `pragma alloc_text`, it looks like GCC compiles the following > `foo` with C linkage vs LLVM which compiles with C++ linkage (foo's name is > mangled): The mangled name shouldn't matter since it has internal linkage. I tried dropping the `static`, and

[PATCH] D126559: [MSVC] Fix pragma alloc_text failing for C files

2022-06-20 Thread Stephen Long via Phabricator via cfe-commits
steplong added a comment. Hmm, it looks like MSVC is accepting: extern "C" { static void foo(); } static int foo(); #pragma alloc_text("s", foo) static void foo() {} Ignoring the `pragma alloc_text`, it looks like GCC compiles the following `foo` with C linkage vs LLVM which

[PATCH] D126559: [MSVC] Fix pragma alloc_text failing for C files

2022-06-01 Thread Stephen Long via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGa5b056fe49a9: [MSVC] Fix pragma alloc_text failing for C files (authored by steplong). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D126559/new/

[PATCH] D126559: [MSVC] Fix pragma alloc_text failing for C files

2022-06-01 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision. aaron.ballman added a comment. LGTM! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D126559/new/ https://reviews.llvm.org/D126559 ___ cfe-commits mailing list

[PATCH] D126559: [MSVC] Fix pragma alloc_text failing for C files

2022-05-31 Thread Stephen Long via Phabricator via cfe-commits
steplong updated this revision to Diff 433194. steplong added a comment. - Handle static C/C++ functions and C functions in general Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D126559/new/ https://reviews.llvm.org/D126559 Files:

[PATCH] D126559: [MSVC] Fix pragma alloc_text failing for C files

2022-05-31 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D126559#3547921 , @steplong wrote: > It looks like MSVC also accepts > > // foo.c > static void foo(); > #pragma alloc_text("hello", foo) > void foo() {} > > and > > // foo.cpp > extern "C" { > static void

[PATCH] D126559: [MSVC] Fix pragma alloc_text failing for C files

2022-05-31 Thread Stephen Long via Phabricator via cfe-commits
steplong added a comment. It looks like MSVC also accepts // foo.c static void foo(); #pragma alloc_text("hello", foo) void foo() {} and // foo.cpp extern "C" { static void foo(); #pragma alloc_text("hello", foo) void foo() {} } Do you know of a way I can check whether a

[PATCH] D126559: [MSVC] Fix pragma alloc_text failing for C files

2022-05-27 Thread Reid Kleckner via Phabricator via cfe-commits
rnk accepted this revision. rnk 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/D126559/new/ https://reviews.llvm.org/D126559 ___

[PATCH] D126559: [MSVC] Fix pragma alloc_text failing for C files

2022-05-27 Thread Stephen Long via Phabricator via cfe-commits
steplong created this revision. Herald added a project: All. steplong requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. `isExternCContext()` is returning false for functions in C files Change-Id: I51cccb476aa19dc0a0a78e951d7f482befdb78ca