[PATCH] D128649: [clang-cl] Accept a pragma alloc_text corner case accepted by MSVC

2022-06-27 Thread Stephen Long via Phabricator via cfe-commits
steplong updated this revision to Diff 440268. steplong added a comment. - Use `getCanonicalDecl()`. This does make us reject (MSVC rejects it already because of conflicting declarations): static void f(); extern "C" { static void f(); } static void f() {} - Error if not function decl

[PATCH] D128649: [clang-cl] Accept a pragma alloc_text corner case accepted by MSVC

2022-06-27 Thread Hans Wennborg via Phabricator via cfe-commits
hans added inline comments. Comment at: clang/lib/Sema/SemaAttr.cpp:811 return; } Since the pragma only applies to functions, maybe we should error here if the decl is not a FunctionDecl? Comment at: clang/lib/Sema/SemaAttr.cpp:8

[PATCH] D128649: [clang-cl] Accept a pragma alloc_text corner case accepted by MSVC

2022-06-27 Thread Stephen Long via Phabricator via cfe-commits
steplong added a comment. This does make us accept, but MSVC doesn't: static void f(); extern "C" { static void f(); } #pragma alloc_text(c, f); static void f() {} MSVC and GCC fail with an error for conflicting declaration. GCC: https://godbolt.org/z/Tavvx88E4 MSVC: https://godbol

[PATCH] D128649: [clang-cl] Accept a pragma alloc_text corner case accepted by MSVC

2022-06-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. MSVC's pragma alloc_text accepts a function that was redeclared in a non extern-C context if the previous declaration was