[PATCH] D125011: [MSVC] Add support for pragma alloc_text

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 11 09:34:24 PDT 2022


aaron.ballman added inline comments.


================
Comment at: clang/test/Sema/pragma-ms-alloc-text.cpp:5
+#pragma alloc_text(a        // expected-warning {{expected ',' in '#pragma alloc_text'}}
+#pragma alloc_text(a, a     // expected-warning {{missing ')' after '#pragma alloc_text'}} expected-error {{use of undeclared a}}
+#pragma alloc_text(L"a", a) // expected-warning {{expected a string literal for the section name}}
----------------
steplong wrote:
> aaron.ballman wrote:
> > This shows we have the parsing logic wrong -- we shouldn't get the use of undeclared identifier a because we shouldn't have gotten into Sema for this one.
> MSVC accepts it and only warns about the missing paren if the identifier is declared like on Line 14. That's why I decided to handle it that way. We can decide to reject it though
I think this is a case we'd probably rather reject -- if someone runs into a problem where they're relying on the MSVC behavior, we can always relax the diagnostic later.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125011



More information about the cfe-commits mailing list