[PATCH] D126559: [MSVC] Fix pragma alloc_text failing for C files
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue May 31 12:16:15 PDT 2022
aaron.ballman added a comment.
In D126559#3547921 <https://reviews.llvm.org/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 foo();
> #pragma alloc_text("hello", foo)
> void foo() {}
> }
>
> Do you know of a way I can check whether a function is coming from c or c++? `isExternC()` returns false for the static case
You can look at `!LangOpts.CPlusPlus` to know that you're in C mode (or C++ mode)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126559/new/
https://reviews.llvm.org/D126559
More information about the cfe-commits
mailing list