This is an archive of the discontinued LLVM Phabricator instance.

clang-cl: Port cl.exe's C4659 to clang-cl
ClosedPublic

Authored by thakis on Jul 8 2019, 8:45 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

thakis created this revision.Jul 8 2019, 8:45 AM
rnk added inline comments.Jul 8 2019, 2:11 PM
clang/lib/Sema/SemaDeclCXX.cpp
2283 ↗(On Diff #208434)

This file seems untouched except for whitespace changes, let's revert them.

clang/test/Sema/pragma-section.c
57 ↗(On Diff #208434)

I agree it probably shouldn't, I imagine mingw users will want to be able to use this kind of code pattern to interop between GCC and Clang:

__attribute__((section(".drective")))
const char LinkerFlags[] = "-export:foo -export:bar";
thakis updated this revision to Diff 208538.Jul 8 2019, 4:28 PM
thakis marked 2 inline comments as done.

comments

thakis added a comment.Jul 8 2019, 4:28 PM

Thanks!

clang/test/Sema/pragma-section.c
57 ↗(On Diff #208434)

That's a nice argument, added as comment :)

rnk accepted this revision.Jul 8 2019, 4:33 PM

lgtm

May I ask what inspired this? :)

This revision is now accepted and ready to land.Jul 8 2019, 4:33 PM
thakis added a comment.Jul 8 2019, 4:45 PM
In D64349#1574742, @rnk wrote:

lgtm

Thanks!

May I ask what inspired this? :)

I was looking through lld/COFF/Driver.cpp for something…ah, right, because D64156 touched it, and because I looked through all uses of getSpelling() for D64253, and noticed that LinkerDriver::parseDirectives() had an empty branch for OPT_natvis. I figured that was probably from before lld-link supported /natvis: and made a note to implement support for /natvis: in a .drectve (anticlimatic result of that sidequest was "link.exe doesn't allow /natvis in .drective", resulting in D64352), and I remembered #pragma data_seg(".drectve") before remembering #pragma comment(linker) and saw that cl.exe had this warning and I thought it was kind of useful.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJul 8 2019, 5:02 PM